diff options
author | Paul Oliver <[email protected]> | 2011-10-24 15:06:51 +0100 |
---|---|---|
committer | Paul Oliver <[email protected]> | 2011-10-24 15:23:36 +0100 |
commit | 30c3c75bbcbbf36c2b82ede0a723f4271e05e510 (patch) | |
tree | f5f56b2babb4060c445e421726800bab5cd189e9 /src/cowboy_http_websocket.erl | |
parent | f990109af6f84a5d66c54e52925c55633a0ad859 (diff) | |
download | cowboy-30c3c75bbcbbf36c2b82ede0a723f4271e05e510.tar.gz cowboy-30c3c75bbcbbf36c2b82ede0a723f4271e05e510.tar.bz2 cowboy-30c3c75bbcbbf36c2b82ede0a723f4271e05e510.zip |
Accept Sec-WebSocket-Version: 13 header on Chrome 15 through 17
Diffstat (limited to 'src/cowboy_http_websocket.erl')
-rw-r--r-- | src/cowboy_http_websocket.erl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cowboy_http_websocket.erl b/src/cowboy_http_websocket.erl index 1111b96..a061ad0 100644 --- a/src/cowboy_http_websocket.erl +++ b/src/cowboy_http_websocket.erl @@ -103,13 +103,15 @@ websocket_upgrade(undefined, State, Req) -> EOP = binary:compile_pattern(<< 255 >>), {ok, State#state{version=0, origin=Origin, challenge={Key1, Key2}, eop=EOP}, Req4}; -%% Versions 7 and 8. Implementation follows the hybi 7 through 10 drafts. -websocket_upgrade(<< Version >>, State, Req) - when Version =:= $7; Version =:= $8 -> +%% Versions 7 and 8. Implementation follows the hybi 7 through 17 drafts. +websocket_upgrade(Version, State, Req) + when Version =:= <<"7">>; Version =:= <<"8">>; + Version =:= <<"13">> -> {Key, Req2} = cowboy_http_req:header(<<"Sec-Websocket-Key">>, Req), false = Key =:= undefined, Challenge = hybi_challenge(Key), - {ok, State#state{version=Version - $0, challenge=Challenge}, Req2}. + IntVersion = list_to_integer(binary_to_list(Version)), + {ok, State#state{version=IntVersion, challenge=Challenge}, Req2}. -spec handler_init(#state{}, #http_req{}) -> ok | none(). handler_init(State=#state{handler=Handler, opts=Opts}, |