mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-15 12:40:25 +00:00
Merge branch 'master' of https://github.com/camshaft/cowboy
This commit is contained in:
commit
e44ac98c83
4 changed files with 55 additions and 5 deletions
|
@ -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}.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue