diff options
author | juhlig <[email protected]> | 2019-06-06 17:52:34 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-07-16 15:35:45 +0200 |
commit | 5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b (patch) | |
tree | bb06aa4e6b00901da26e44f546f97f447e995f18 /src/cowboy_tls.erl | |
parent | 7708fc77cd95768aef65bd0eb366ee300cc0515f (diff) | |
download | cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.tar.gz cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.tar.bz2 cowboy-5b4e78fac483c5eb277fec4ab7e8c6a62821bf4b.zip |
Make Cowboy compatible with upcoming Ranch 2.0
Diffstat (limited to 'src/cowboy_tls.erl')
-rw-r--r-- | src/cowboy_tls.erl | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cowboy_tls.erl b/src/cowboy_tls.erl index 864a613..c049ecb 100644 --- a/src/cowboy_tls.erl +++ b/src/cowboy_tls.erl @@ -15,17 +15,24 @@ -module(cowboy_tls). -behavior(ranch_protocol). +-export([start_link/3]). -export([start_link/4]). --export([connection_process/5]). +-export([connection_process/4]). +%% Ranch 1. -spec start_link(ranch:ref(), ssl:sslsocket(), module(), cowboy:opts()) -> {ok, pid()}. -start_link(Ref, Socket, Transport, Opts) -> +start_link(Ref, _Socket, Transport, Opts) -> + start_link(Ref, Transport, Opts). + +%% Ranch 2. +-spec start_link(ranch:ref(), module(), cowboy:opts()) -> {ok, pid()}. +start_link(Ref, Transport, Opts) -> Pid = proc_lib:spawn_link(?MODULE, connection_process, - [self(), Ref, Socket, Transport, Opts]), + [self(), Ref, Transport, Opts]), {ok, Pid}. --spec connection_process(pid(), ranch:ref(), ssl:sslsocket(), module(), cowboy:opts()) -> ok. -connection_process(Parent, Ref, Socket, Transport, Opts) -> +-spec connection_process(pid(), ranch:ref(), module(), cowboy:opts()) -> ok. +connection_process(Parent, Ref, Transport, Opts) -> ProxyInfo = case maps:get(proxy_header, Opts, false) of true -> {ok, ProxyInfo0} = ranch:recv_proxy_header(Ref, 1000), |