diff options
-rw-r--r-- | src/gun_http2.erl | 7 | ||||
-rw-r--r-- | test/rfc7540_SUITE.erl | 15 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/gun_http2.erl b/src/gun_http2.erl index ad52555..4908b6f 100644 --- a/src/gun_http2.erl +++ b/src/gun_http2.erl @@ -366,11 +366,6 @@ tunnel_commands([{switch_protocol, Protocol0, ReplyTo}|Tail], Stream=#stream{ref %% @todo We need to allow other protocol opts in http2_opts too. {Protocol1, maps:get(Protocol1:opts_name(), Opts, #{})} end, - %% When we switch_protocol from socks we must send a gun_tunnel_up message. - _ = case CurrentProtocol of - gun_socks -> ReplyTo ! {gun_tunnel_up, self(), stream_ref(State, StreamRef), Protocol:name()}; - _ -> ok - end, RealStreamRef = stream_ref(State, StreamRef), OriginSocket = #{ gun_pid => self(), @@ -665,7 +660,7 @@ handle_continue(StreamRef, Msg, State, EvHandler, EvHandlerState0) %% Data that was received and decrypted. {tls_proxy, ProxyPid, Data} -> {Commands, EvHandlerState} = Protocol:handle(Data, ProtoState0, EvHandler, EvHandlerState0), - {tunnel_commands(Commands, Stream, Protocol, TunnelInfo, State), EvHandlerState}; + {{state, tunnel_commands(Commands, Stream, Protocol, TunnelInfo, State)}, EvHandlerState}; %% @todo What to do about those? {tls_proxy_closed, ProxyPid} -> todo; diff --git a/test/rfc7540_SUITE.erl b/test/rfc7540_SUITE.erl index 38cbe9f..2ceecdd 100644 --- a/test/rfc7540_SUITE.erl +++ b/test/rfc7540_SUITE.erl @@ -435,7 +435,10 @@ 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_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_http(<<"https">>, tls, http, <<"http">>, tcp). connect_http_via_h2(_) -> doc("CONNECT can be used to establish a TCP connection " @@ -452,11 +455,21 @@ connect_h2c_via_h2c(_) -> "to an HTTP/2 server via a TCP HTTP/2 proxy. (RFC7540 8.3)"), do_connect_http(<<"http">>, tcp, http2, <<"http">>, tcp). +connect_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_http(<<"https">>, tls, http2, <<"http">>, tcp). + connect_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_http(<<"http">>, tcp, http2, <<"https">>, tls). +connect_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_http(<<"https">>, tls, http2, <<"https">>, tls). + do_origin_fun(http) -> fun(Parent, Socket, Transport) -> %% Receive the request-line and headers, parse and send them. |