aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2017-04-18 14:06:34 +0200
committerLoïc Hoguin <[email protected]>2017-04-18 14:06:34 +0200
commit6e8b907ae25a7a988abbcd7206b978028c36f47e (patch)
treee6271be24334110a69313efb286269def76d9f75 /src/cowboy_http.erl
parent3633bceac573df22ebffceff771a6f72247c322f (diff)
downloadcowboy-6e8b907ae25a7a988abbcd7206b978028c36f47e.tar.gz
cowboy-6e8b907ae25a7a988abbcd7206b978028c36f47e.tar.bz2
cowboy-6e8b907ae25a7a988abbcd7206b978028c36f47e.zip
Pass the HTTP/2 switch_protocol event to stream handlers
To accomplish this the code for sending the 101 response was moved to the cowboy_http2 module.
Diffstat (limited to 'src/cowboy_http.erl')
-rw-r--r--src/cowboy_http.erl8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/cowboy_http.erl b/src/cowboy_http.erl
index e6cceae..983d95f 100644
--- a/src/cowboy_http.erl
+++ b/src/cowboy_http.erl
@@ -635,6 +635,7 @@ request(Buffer, State0=#state{ref=Ref, transport=Transport, peer=Peer, in_stream
%% HTTP/2 upgrade.
+%% @todo We must not upgrade to h2c over a TLS connection.
is_http2_upgrade(#{<<"connection">> := Conn, <<"upgrade">> := Upgrade,
<<"http2-settings">> := HTTP2Settings}, 'HTTP/1.1') ->
Conns = cow_http_hd:parse_connection(Conn),
@@ -675,13 +676,6 @@ http2_upgrade(State=#state{parent=Parent, ref=Ref, socket=Socket, transport=Tran
%% Always half-closed stream coming from this side.
try cow_http_hd:parse_http2_settings(HTTP2Settings) of
Settings ->
- %% @todo We should invoke cowboy_stream:info for this stream,
- %% with a switch_protocol tuple.
- Transport:send(Socket, cow_http:response(101, 'HTTP/1.1', maps:to_list(#{
- <<"connection">> => <<"Upgrade">>,
- <<"upgrade">> => <<"h2c">>
- }))),
- %% @todo Possibly redirect the request if it was https.
_ = cancel_request_timeout(State),
cowboy_http2:init(Parent, Ref, Socket, Transport, Opts, Peer, Buffer, Settings, Req)
catch _:_ ->