diff options
author | Loïc Hoguin <[email protected]> | 2020-08-24 17:06:23 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-09-21 15:51:57 +0200 |
commit | d056e5fb2a1fbb54e108c5c61384573acf21b4cf (patch) | |
tree | ccf9131d63fbace32e2d99941fb6b1d788f6ec7f /test/socks_SUITE.erl | |
parent | 2c8db0879109dd90443d7b276e5ca2daf83920bc (diff) | |
download | gun-d056e5fb2a1fbb54e108c5c61384573acf21b4cf.tar.gz gun-d056e5fb2a1fbb54e108c5c61384573acf21b4cf.tar.bz2 gun-d056e5fb2a1fbb54e108c5c61384573acf21b4cf.zip |
Replace gun_tunnel_up/3 message with /4 variant
Also fixes all the tests. Lots of work remain around protocols
(how best to pass the base stream_ref to them? maybe the current
solution, maybe a new argument to Protocol:init) and strengthen
the concept of stream_ref, at least with its own type.
Diffstat (limited to 'test/socks_SUITE.erl')
-rw-r--r-- | test/socks_SUITE.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/socks_SUITE.erl b/test/socks_SUITE.erl index 436ea3f..3b8c822 100644 --- a/test/socks_SUITE.erl +++ b/test/socks_SUITE.erl @@ -224,7 +224,7 @@ do_socks5(OriginScheme, OriginTransport, OriginProtocol, ProxyTransport, SocksAu }), %% We receive a gun_up and a gun_tunnel_up. {ok, socks} = gun:await_up(ConnPid), - {ok, OriginProtocol} = gun:await_up(ConnPid), + {up, OriginProtocol} = gun:await(ConnPid, undefined), %% The proxy received two packets. AuthMethod = do_auth_method(SocksAuth), {auth_methods, 1, [AuthMethod]} = receive_from(ProxyPid), @@ -302,8 +302,8 @@ do_socks5_through_multiple_proxies(OriginScheme, OriginTransport, ProxyTransport }), %% We receive a gun_up and two gun_tunnel_up. {ok, socks} = gun:await_up(ConnPid), - {ok, socks} = gun:await_up(ConnPid), - {ok, http} = gun:await_up(ConnPid), + {up, socks} = gun:await(ConnPid, undefined), + {up, http} = gun:await(ConnPid, undefined), %% The first proxy received two packets. {auth_methods, 1, [none]} = receive_from(Proxy1Pid), {connect, <<"localhost">>, Proxy2Port} = receive_from(Proxy1Pid), @@ -382,8 +382,9 @@ do_socks5_through_connect_proxy(OriginScheme, OriginTransport, ProxyTransport) - }), {request, <<"CONNECT">>, Authority1, 'HTTP/1.1', _} = receive_from(Proxy1Pid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef), - %% We receive a gun_tunnel_up afterwards. This is the origin HTTP server. - {ok, http} = gun:await_up(ConnPid), + %% We receive two gun_tunnel_up messages. First the SOCKS server and then the origin HTTP server. + {up, socks} = gun:await(ConnPid, StreamRef), + {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), |