0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Add 'Accept' header parsing

Rework the cowboy_http_req:parse_header/2 function while I was at it.
This commit is contained in:
Loïc Hoguin 2011-10-26 04:07:08 +02:00
parent 1a839954bb
commit c605c4fa40
4 changed files with 259 additions and 37 deletions

View file

@ -77,7 +77,7 @@ upgrade(ListenerPid, Handler, Opts, Req) ->
%% @todo Upgrade is a list of products and should be parsed as such.
-spec websocket_upgrade(#state{}, #http_req{}) -> {ok, #state{}, #http_req{}}.
websocket_upgrade(State, Req) ->
{tokens, ConnTokens, Req2}
{ConnTokens, Req2}
= cowboy_http_req:parse_header('Connection', Req),
true = lists:member(<<"upgrade">>, ConnTokens),
{WS, Req3} = cowboy_http_req:header('Upgrade', Req2),