diff options
author | Loïc Hoguin <[email protected]> | 2016-08-12 17:01:01 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-12 17:26:28 +0200 |
commit | e44ac98c8328273ad32ef99ad7d24c713066ffd3 (patch) | |
tree | 5eae076b5c31cd17b54cc5875593c390db58534d /src | |
parent | 97986df27606bbc89db59fb2fe59b1b9aec630e2 (diff) | |
parent | e09a85680540029df22001073f73b77eec67773d (diff) | |
download | cowboy-e44ac98c8328273ad32ef99ad7d24c713066ffd3.tar.gz cowboy-e44ac98c8328273ad32ef99ad7d24c713066ffd3.tar.bz2 cowboy-e44ac98c8328273ad32ef99ad7d24c713066ffd3.zip |
Merge branch 'master' of https://github.com/camshaft/cowboy
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_req.erl | 3 | ||||
-rw-r--r-- | src/cowboy_websocket.erl | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 79ab062..4235f6d 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -77,6 +77,9 @@ -export([push/3]). -export([push/4]). +%% Internal. +-export([response_headers/2]). + -type cookie_opts() :: cow_cookie:cookie_opts(). -export_type([cookie_opts/0]). diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 6551a0c..bc9bd31 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -158,12 +158,11 @@ websocket_handshake(State=#state{key=Key}, Req=#{pid := Pid, streamid := StreamID}, HandlerState, Env) -> Challenge = base64:encode(crypto:hash(sha, << Key/binary, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" >>)), - Headers = #{ - %% @todo Hmm should those be here or in cowboy_http? + Headers = cowboy_req:response_headers(#{ <<"connection">> => <<"Upgrade">>, <<"upgrade">> => <<"websocket">>, <<"sec-websocket-accept">> => Challenge - }, + }, Req), Pid ! {{Pid, StreamID}, {switch_protocol, Headers, ?MODULE, {Req, State, HandlerState}}}, {ok, Req, Env}. |