diff options
author | Loïc Hoguin <[email protected]> | 2020-08-20 16:06:59 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-09-21 15:51:57 +0200 |
commit | 2c8db0879109dd90443d7b276e5ca2daf83920bc (patch) | |
tree | fe444ef7e4def97473a5c723bff750c98dce0964 /src | |
parent | e1de84585490e85166926416e4eb5cea95e0e604 (diff) | |
download | gun-2c8db0879109dd90443d7b276e5ca2daf83920bc.tar.gz gun-2c8db0879109dd90443d7b276e5ca2daf83920bc.tar.bz2 gun-2c8db0879109dd90443d7b276e5ca2daf83920bc.zip |
Rename the 3-arity gun_socks_up to gun_tunnel_up
Diffstat (limited to 'src')
-rw-r--r-- | src/gun.erl | 7 | ||||
-rw-r--r-- | src/gun_http.erl | 2 | ||||
-rw-r--r-- | src/gun_http2.erl | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/gun.erl b/src/gun.erl index e83c709..2f92b95 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -808,8 +808,7 @@ await_up(ServerPid, Timeout, MRef) -> receive {gun_up, ServerPid, Protocol} -> {ok, Protocol}; - %% @todo Maybe name it gun_tunnel_up. And send it for HTTP/1.1 CONNECT and HTTP/2 CONNECT and SOCKS. - {gun_socks_up, ServerPid, Protocol} -> + {gun_tunnel_up, ServerPid, Protocol} -> {ok, Protocol}; {'DOWN', MRef, process, ServerPid, Reason} -> {error, {down, Reason}} @@ -1587,9 +1586,9 @@ commands([{switch_protocol, Protocol0, ReplyTo}], State0=#state{ Protocol1 = protocol_handler(P), {Protocol1, maps:get(Protocol1:opts_name(), Opts, #{})} end, - %% When we switch_protocol from socks we must send a gun_socks_up message. + %% When we switch_protocol from socks we must send a gun_tunnel_up message. _ = case CurrentProtocol of - gun_socks -> ReplyTo ! {gun_socks_up, self(), Protocol:name()}; + gun_socks -> ReplyTo ! {gun_tunnel_up, self(), Protocol:name()}; _ -> ok end, {StateName, ProtoState} = Protocol:init(ReplyTo, Socket, Transport, ProtoOpts), diff --git a/src/gun_http.erl b/src/gun_http.erl index 6b511a3..bced64d 100644 --- a/src/gun_http.erl +++ b/src/gun_http.erl @@ -340,12 +340,14 @@ handle_connect(Rest, State=#http_state{ timeout => maps:get(tls_handshake_timeout, Destination, infinity) }, Protocols = maps:get(protocols, Destination, [http2, http]), +%% @todo gun_tunnel_up when the protocol switch is complete {handle_ret([ {origin, <<"https">>, NewHost, NewPort, connect}, {tls_handshake, HandshakeEvent, Protocols, ReplyTo} ], State), EvHandlerState1}; _ -> [Protocol] = maps:get(protocols, Destination, [http]), +%% @todo gun_tunnel_up {handle_ret([ {origin, <<"http">>, NewHost, NewPort, connect}, {switch_protocol, Protocol, ReplyTo} diff --git a/src/gun_http2.erl b/src/gun_http2.erl index da6747b..5b8d229 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -366,7 +366,7 @@ tunnel_commands([{switch_protocol, Protocol0, ReplyTo}|Tail], Stream=#stream{ref %% @todo We need to allow other protocol opts in http2_opts too. {Protocol1, maps:get(Protocol1:opts_name(), Opts, #{})} end, - %% When we switch_protocol from socks we must send a gun_socks_up message. + %% When we switch_protocol from socks we must send a gun_tunnel_up message. _ = case CurrentProtocol of gun_socks -> ReplyTo ! {gun_tunnel_up, self(), stream_ref(State, StreamRef), Protocol:name()}; _ -> ok |