aboutsummaryrefslogtreecommitdiffstats
path: root/src/ranch_tcp.erl
AgeCommit message (Collapse)Author
2020-04-20Delete local socket file when a listener closesjuhlig
2020-04-02Delete possibly existing socket file when listening on a local socketjuhlig
2019-10-14Enable multiple steps handshakejuhlig
Also fix some Protocol:start_link/4 into start_link/3 left over in the documentation.
2019-07-01Add missing specsjuhlig
2019-05-27Use transport options in ranch_transport:listen/1 callbacksjuhlig
The callback `ranch_transport:listen/1` has changed to accept a map of transport options instead of socket options.
2019-05-22Add inet:local_address() to ranch_tcp ip optionjuhlig
2019-05-18Add support for UNIX domain socketsjuhlig
It was working already but the types were wrong and some small details needed to be corrected.
2019-05-13Add the passive messages to ranch_transport:messages/0Loïc Hoguin
2019-05-09Use ssl:handshake instead of ssl:ssl_acceptLoïc Hoguin
This makes Ranch require OTP-21+. The function ranch:accept_ack/1 was also removed in this commit.
2019-05-06Fix some whitespaceLoïc Hoguin
2018-10-23Add ranch:recv_proxy_header/2Loïc Hoguin
This is the function that should be called regardless of TCP or TLS being used. The proper usage for this function is: {ok, ProxyInfo} = ranch:recv_proxy_header(Ref, Timeout), {ok, Socket} = ranch:handshake(Ref), ... Ranch takes care of everything else under the hood. Transports now need to have a Transport:recv_proxy_header/2 function. For ranch_ssl the function gets the port from the sslsocket() record and then calls ranch_tcp:recv_proxy_header/2 with it. This means that two undocumented features are currently used for this, but the interface is really nice so that's a sacrifice worth doing. Also worth noting is that OTP 22 should have an alternative for gen_tcp:unrecv/2 so the only real issue is about the sslsocket() record at the moment.
2018-10-10Add ranch_tcp:recv_proxy_header/2Loïc Hoguin
This uses the undocumented function gen_tcp:unrecv/2. Tests have been added for both gen_tcp and ssl connections, including sending data in the same first packet, at least for gen_tcp (ssl tests may or may not end up buffering some of the TLS handshake before the recv call, but there's no guarantees).
2018-07-31Fix some whitespaceLoïc Hoguin
2018-07-02Introduce Transport:handshake/1,2j.uhlig
This commit deprecates Transport:accept_ack/1 in favor of a new forward-compatible function. Transport:handshake/1,2 will use ssl:handshake/2,3 from Ranch 2.0 onward.
2018-04-10Ranch 1.5.01.5.0Loïc Hoguin
2018-01-22Added transport functions getopts/2, getstat/1 and getstat/2Jan Uhlig
2017-06-07Update Copyright to 20171.4.0Loïc Hoguin
2016-11-24Update copyright yearLoïc Hoguin
2016-11-08Blacklist listen options instead of whitelistLoïc Hoguin
Dialyzer will still complain about unknown options, but at least users won't be stuck waiting for an upstream update.
2016-09-19Add ipv6_v6only listen optionMarc Worrell
2015-08-18Welcome to 2015Loïc Hoguin
2015-08-18Update the list of allowed transport optionsLoïc Hoguin
We are now up to date with regard to transport options we should accept for the listening socket. Documentation of existing options has been updated with regard to recent changes in the OTP docs and type specifications.
2015-08-17Don't pass Ranch-specific options down to transportsLoïc Hoguin
Should fix Dialyzer issues. The options are now also documented in the Ranch module, and there's new ranch:opt(), ranch_tcp:opt() and ranch_ssl:opt() for use in third party code.
2014-09-02Add Transport:secure/0Stéphane Wirtel
Currently Ranch checks if a connection is secure by checking if its name is 'ssl'. This isn't a very modular solution, adding an API function that returns whether a connection is secure.
2014-06-10Update copyright yearsLoïc Hoguin
2013-12-07Add Transport:shutdown/2Loïc Hoguin
Allows closing the socket in one or two directions.
2013-12-07Get rid of a ton of pointless commentsLoïc Hoguin
All of it can be found in the manual, which defines what the code must do, and is always up to date unlike the code comments.
2013-12-07Add transport options linger, send_timeout, send_timeout_closeLoïc Hoguin
2013-12-07Merge branch 'connect_timeout' of git://github.com/heroku/ranchLoïc Hoguin
2013-11-26Add accept_ack on all transports and ack_timeout transport optionLoïc Hoguin
Doing this in the connection process allows us to free acceptors to start accepting more connections quicker, especially under load.
2013-11-25Small fixes to specsLoïc Hoguin
2013-11-07Implements ranch_transport:connect/4.Geoff Cant
Adds a transport connect method that takes a timeout, with implementations for both ssl and tcp connections.
2013-08-16Add Transport:sendfile/4,/5James Fish
Adds offset based sendfile to transports. Same behaviour as file:sendfile/4,/5 except socket and file arguments are reversed and either a raw file or a filename can be used. sendfile/2,/4,/5 now compulsory callbacks in ranch_transport. ranch_tcp:sendfile/2 now defaults to a chunk_size of 8191 - the default for ranch_ssl:sendfile/2. The same default is used for both ranch_tcp:sendfile/4,5 and ranch_ssl:sendfile/4,5.
2013-05-16Add ranch_tcp:opts() typeLoïc Hoguin
2013-03-28Catch badmatch errors when using file:sendfileAli Sabil
2013-01-15Allow raw socket options for TCP and SSLFred Hebert
This patch lets the user set and use raw socket options as described in inet:setopts/2 documentation. The raw options can be useful to use TCP features that are platform- specific and not supported in inet in general, such as TCP_DEFER_ACCEPT or TCP_LINGER2 in linux stacks, for example.
2012-12-01Add Transport:sendfile/2 supportLoïc Hoguin
Uses file:sendfile/2 for TCP, a fallback function for SSL.
2012-12-01Fix typespecs for Transport:send/2Loïc Hoguin
2012-11-12Allow IP tuples and more when connecting transportsLoïc Hoguin
2012-09-26Add the {nodelay, boolean()} option controlling TCP_NODELAYLoïc Hoguin
Enabled by default. A comprehensive explanation about TCP_NODELAY and the Nagle algorithm can be found at http://www.stuartcheshire.org/papers/NagleDelayedAck/
2012-08-20Add the 'ranch_transport' behaviourLoïc Hoguin
At the same time we make the 'port' option optional, defaulting to 0.
2012-06-04Add Transport:connect/3 and remove types unneeded by R15B+0.2.1Loïc Hoguin
Also use one export per line to improve future diffs. Bump the version to 0.2.1 to reflect this change.
2012-04-14Import the acceptor code from CowboyLoïc Hoguin
Modules were renamed. The 'cowboy_' prefix became 'ranch_'. At the same time, ranch_ssl_transport became ranch_ssl, and ranch_tcp_transport became ranch_tcp, because appending '_transport' felt a bit redundant considering SSL and TCP clearly are transports. One test has been added to make sure everything is working.