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/rfc7231_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/rfc7231_SUITE.erl')
-rw-r--r-- | test/rfc7231_SUITE.erl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/rfc7231_SUITE.erl b/test/rfc7231_SUITE.erl index c2f3da6..5ef37bd 100644 --- a/test/rfc7231_SUITE.erl +++ b/test/rfc7231_SUITE.erl @@ -168,7 +168,9 @@ do_connect_http(OriginScheme, OriginTransport, ProxyTransport) -> }), {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef), + %% @todo Do we still need these handshake_completed messages? handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), @@ -223,6 +225,7 @@ do_connect_h2(OriginScheme, OriginTransport, ProxyTransport) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef), handshake_completed = receive_from(OriginPid), + {up, http2} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), <<_:24, 1:8, _/bits>> = receive_from(OriginPid), #{ @@ -268,15 +271,17 @@ do_connect_through_multiple_proxies(OriginScheme, OriginTransport, ProxiesTransp }), {request, <<"CONNECT">>, Authority1, 'HTTP/1.1', _} = receive_from(Proxy1Pid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef1), + {up, http} = gun:await(ConnPid, StreamRef1), Authority2 = iolist_to_binary(["localhost:", integer_to_binary(OriginPort)]), StreamRef2 = gun:connect(ConnPid, #{ host => "localhost", port => OriginPort, transport => OriginTransport - }), + }, [], #{tunnel => StreamRef1}), {request, <<"CONNECT">>, Authority2, 'HTTP/1.1', _} = receive_from(Proxy2Pid), {response, fin, 200, _} = gun:await(ConnPid, StreamRef2), handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef2), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), @@ -317,6 +322,7 @@ connect_delay(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid, 3000), {response, fin, 201, _} = gun:await(ConnPid, StreamRef), handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), @@ -351,6 +357,7 @@ connect_response_201(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid), {response, fin, 201, _} = gun:await(ConnPid, StreamRef), handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), @@ -492,6 +499,7 @@ connect_response_ignore_transfer_encoding(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid), {response, fin, 200, Headers} = gun:await(ConnPid, StreamRef), handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), @@ -514,6 +522,7 @@ connect_response_ignore_content_length(_) -> {request, <<"CONNECT">>, Authority, 'HTTP/1.1', _} = receive_from(ProxyPid), {response, fin, 200, Headers} = gun:await(ConnPid, StreamRef), handshake_completed = receive_from(OriginPid), + {up, http} = gun:await(ConnPid, StreamRef), _ = gun:get(ConnPid, "/proxied"), Data = receive_from(OriginPid), Lines = binary:split(Data, <<"\r\n">>, [global]), |