aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_websocket.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-10-24 16:27:14 +0200
committerLoïc Hoguin <[email protected]>2011-10-24 16:27:14 +0200
commitd7eec7d8c32c8efdac9aaadc989599836889589e (patch)
treef5f56b2babb4060c445e421726800bab5cd189e9 /src/cowboy_http_websocket.erl
parentf990109af6f84a5d66c54e52925c55633a0ad859 (diff)
parent30c3c75bbcbbf36c2b82ede0a723f4271e05e510 (diff)
downloadcowboy-d7eec7d8c32c8efdac9aaadc989599836889589e.tar.gz
cowboy-d7eec7d8c32c8efdac9aaadc989599836889589e.tar.bz2
cowboy-d7eec7d8c32c8efdac9aaadc989599836889589e.zip
Merge branch 'chrome-15' of https://github.com/puzza007/cowboy
Diffstat (limited to 'src/cowboy_http_websocket.erl')
-rw-r--r--src/cowboy_http_websocket.erl10
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},