aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-08-20 15:29:38 +0200
committerLoïc Hoguin <[email protected]>2020-09-21 15:51:57 +0200
commite1de84585490e85166926416e4eb5cea95e0e604 (patch)
treeac01fc5c8d98818eb82fa4d3415db472857c4990 /test
parentca68d184abbf7bd1030b2f2035cc66c13d08dd5d (diff)
downloadgun-e1de84585490e85166926416e4eb5cea95e0e604.tar.gz
gun-e1de84585490e85166926416e4eb5cea95e0e604.tar.bz2
gun-e1de84585490e85166926416e4eb5cea95e0e604.zip
Add gun_tunnel_up message to HTTP/2 CONNECT
Diffstat (limited to 'test')
-rw-r--r--test/raw_SUITE.erl1
-rw-r--r--test/rfc7540_SUITE.erl15
-rw-r--r--test/socks_SUITE.erl3
3 files changed, 4 insertions, 15 deletions
diff --git a/test/raw_SUITE.erl b/test/raw_SUITE.erl
index 3d17357..9875467 100644
--- a/test/raw_SUITE.erl
+++ b/test/raw_SUITE.erl
@@ -295,6 +295,7 @@ do_http2_connect_raw(OriginTransport, ProxyScheme, ProxyTransport) ->
}} = receive_from(ProxyPid),
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
handshake_completed = receive_from(OriginPid),
+ {up, raw} = gun:await(ConnPid, StreamRef),
gun:data(ConnPid, StreamRef, nofin, <<"Hello world!">>),
{data, nofin, <<"Hello world!">>} = gun:await(ConnPid, StreamRef),
#{
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl
index a6bb440..38cbe9f 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -443,14 +443,6 @@ connect_http_via_h2(_) ->
do_connect_http(<<"http">>, tcp, http, <<"https">>, tls).
connect_https_via_h2(_) ->
-
-%dbg:tracer(),
-%dbg:tpl(gun, []),
-%dbg:tpl(gun_http2, []),
-%dbg:tpl(gun_tls_proxy, []),
-%dbg:tpl(gun_tls_proxy_http2_connect, []),
-%dbg:p(all, c),
-
doc("CONNECT can be used to establish a TLS connection "
"to an HTTP/1.1 server via a TLS HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_http(<<"https">>, tls, http, <<"https">>, tls).
@@ -514,12 +506,7 @@ do_connect_http(OriginScheme, OriginTransport, OriginProtocol, ProxyScheme, Prox
}} = receive_from(ProxyPid),
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
handshake_completed = receive_from(OriginPid),
- %% @todo The 200 response must not be sent before the TLS handshake completed successfully?
- %% Or the coming request must be kept around until the tunnel is up? We probably need
- %% to gun_tunnel_up or something to inform the user the tunnel is up.
- %%
- %% @todo QUEUE data until the tunnel is up? Send a gun_up of some kind?
- timer:sleep(1000),
+ {up, OriginProtocol} = gun:await(ConnPid, StreamRef),
ProxiedStreamRef = gun:get(ConnPid, "/proxied", #{}, #{tunnel => StreamRef}),
#{<<":authority">> := Authority} = receive_from(OriginPid),
#{
diff --git a/test/socks_SUITE.erl b/test/socks_SUITE.erl
index b577cb9..5e15eac 100644
--- a/test/socks_SUITE.erl
+++ b/test/socks_SUITE.erl
@@ -449,7 +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 stream-specific gun_socks_up afterwards. This is the origin HTTP server.
+ %% First the HTTP/2 tunnel is up, then the SOCKS tunnel to 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),