aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-08-19 17:24:27 +0200
committerLoïc Hoguin <[email protected]>2020-09-21 15:51:57 +0200
commitca68d184abbf7bd1030b2f2035cc66c13d08dd5d (patch)
tree77a5800cbfc3da76e7863e1bbb51d83442bddf50 /test
parenta1729d5584364412f72d0d6337447da653da865b (diff)
downloadgun-ca68d184abbf7bd1030b2f2035cc66c13d08dd5d.tar.gz
gun-ca68d184abbf7bd1030b2f2035cc66c13d08dd5d.tar.bz2
gun-ca68d184abbf7bd1030b2f2035cc66c13d08dd5d.zip
First working HTTPS over secure HTTP/2
Has a timer:sleep/1 though because there is currently no way to wait for the TLS handshake to complete.
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 ebc5392..a6bb440 100644
--- a/test/rfc7540_SUITE.erl
+++ b/test/rfc7540_SUITE.erl
@@ -435,11 +435,26 @@ connect_http_via_h2c(_) ->
"to an HTTP/1.1 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"),
do_connect_http(<<"http">>, tcp, http, <<"http">>, tcp).
+%% @todo https
+
connect_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_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).
+
connect_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)"),
@@ -499,6 +514,12 @@ 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),
ProxiedStreamRef = gun:get(ConnPid, "/proxied", #{}, #{tunnel => StreamRef}),
#{<<":authority">> := Authority} = receive_from(OriginPid),
#{