aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-08-26 17:34:56 +0200
committerLoïc Hoguin <[email protected]>2020-09-21 15:51:58 +0200
commit839f31e97504e10b8eef4897aa1271a53137cc29 (patch)
tree3d478b8914d412b0156d5fc630b8435ed174266a /test
parent35d9f47fbcff23395c256b7814ce6af1d85129a2 (diff)
downloadgun-839f31e97504e10b8eef4897aa1271a53137cc29.tar.gz
gun-839f31e97504e10b8eef4897aa1271a53137cc29.tar.bz2
gun-839f31e97504e10b8eef4897aa1271a53137cc29.zip
Add more HTTP/2 CONNECT tests
Diffstat (limited to 'test')
-rw-r--r--test/rfc7540_SUITE.erl21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl
index 2ceecdd..8669b13 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -561,21 +561,41 @@ connect_cowboy_http_via_h2c(_) ->
"to an HTTP/1.1 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_cowboy(<<"http">>, tcp, http, <<"http">>, tcp).
+connect_cowboy_https_via_h2c(_) ->
+ doc("CONNECT can be used to establish a TLS connection "
+ "to an HTTP/1.1 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"),
+ do_connect_cowboy(<<"https">>, tls, http, <<"http">>, tcp).
+
connect_cowboy_http_via_h2(_) ->
doc("CONNECT can be used to establish a TCP connection "
"to an HTTP/1.1 server via a TLS HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_cowboy(<<"http">>, tcp, http, <<"https">>, tls).
+connect_cowboy_https_via_h2(_) ->
+ 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_cowboy(<<"https">>, tls, http, <<"https">>, tls).
+
connect_cowboy_h2c_via_h2c(_) ->
doc("CONNECT can be used to establish a TCP connection "
"to an HTTP/2 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_cowboy(<<"http">>, tcp, http2, <<"http">>, tcp).
+connect_cowboy_h2_via_h2c(_) ->
+ doc("CONNECT can be used to establish a TLS connection "
+ "to an HTTP/2 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"),
+ do_connect_cowboy(<<"https">>, tls, http2, <<"http">>, tcp).
+
connect_cowboy_h2c_via_h2(_) ->
doc("CONNECT can be used to establish a TCP connection "
"to an HTTP/2 server via a TLS HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_cowboy(<<"http">>, tcp, http2, <<"https">>, tls).
+connect_cowboy_h2_via_h2(_) ->
+ doc("CONNECT can be used to establish a TLS connection "
+ "to an HTTP/2 server via a TLS HTTP/2 proxy. (RFC7540 8.3)"),
+ do_connect_cowboy(<<"https">>, tls, http2, <<"https">>, tls).
+
do_connect_cowboy(_OriginScheme, OriginTransport, OriginProtocol, _ProxyScheme, ProxyTransport) ->
{ok, Ref, OriginPort} = do_cowboy_origin(OriginTransport, OriginProtocol),
try
@@ -601,6 +621,7 @@ do_connect_cowboy(_OriginScheme, OriginTransport, OriginProtocol, _ProxyScheme,
<<":authority">> := Authority
}} = receive_from(ProxyPid),
{response, nofin, 200, _} = gun:await(ConnPid, StreamRef),
+ {up, OriginProtocol} = gun:await(ConnPid, StreamRef),
ProxiedStreamRef = gun:get(ConnPid, "/proxied", #{}, #{tunnel => StreamRef}),
{response, nofin, 200, _} = gun:await(ConnPid, ProxiedStreamRef),
%% We can create more requests on the proxy as well.