aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gun.erl2
-rw-r--r--src/gun_http2.erl3
-rw-r--r--test/socks_SUITE.erl4
3 files changed, 5 insertions, 4 deletions
diff --git a/src/gun.erl b/src/gun.erl
index 987b806..9d16f58 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -719,6 +719,8 @@ await(ServerPid, StreamRef, Timeout, MRef) ->
{upgrade, Protocols, Headers};
{gun_ws, ServerPid, StreamRef, Frame} ->
{ws, Frame};
+ {gun_socks_up, ServerPid, StreamRef, Protocol} ->
+ {up, Protocol};
{gun_error, ServerPid, StreamRef, Reason} ->
{error, {stream_error, Reason}};
{gun_error, ServerPid, Reason} ->
diff --git a/src/gun_http2.erl b/src/gun_http2.erl
index b8ae033..11dbb3d 100644
--- a/src/gun_http2.erl
+++ b/src/gun_http2.erl
@@ -368,9 +368,8 @@ tunnel_commands([{switch_protocol, Protocol0, ReplyTo}|Tail], Stream=#stream{ref
{Protocol1, maps:get(Protocol1:opts_name(), Opts, #{})}
end,
%% When we switch_protocol from socks we must send a gun_socks_up message.
-%% @todo OK but perhaps we should give the StreamRef!!
_ = case CurrentProtocol of
- gun_socks -> ReplyTo ! {gun_socks_up, self(), Protocol:name()};
+ gun_socks -> ReplyTo ! {gun_socks_up, self(), stream_ref(State, StreamRef), Protocol:name()};
_ -> ok
end,
OriginSocket = #{
diff --git a/test/socks_SUITE.erl b/test/socks_SUITE.erl
index 72b038c..b577cb9 100644
--- a/test/socks_SUITE.erl
+++ b/test/socks_SUITE.erl
@@ -449,8 +449,8 @@ do_socks5_through_h2_connect_proxy(OriginScheme, OriginTransport, ProxyScheme, P
<<":authority">> := Authority1
}} = receive_from(Proxy1Pid),
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
- %% We receive a gun_socks_up afterwards. This is the origin HTTP server.
- {ok, http} = gun:await_up(ConnPid),
+ %% We receive a stream-specific gun_socks_up afterwards. This is the origin HTTP server.
+ {up, http} = gun:await(ConnPid, StreamRef),
%% The second proxy receives a Socks5 auth/connect request.
{auth_methods, 1, [none]} = receive_from(Proxy2Pid),
{connect, <<"localhost">>, OriginPort} = receive_from(Proxy2Pid),