From ca68d184abbf7bd1030b2f2035cc66c13d08dd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 19 Aug 2020 17:24:27 +0200 Subject: 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. --- test/rfc7540_SUITE.erl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') 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), #{ -- cgit v1.2.3