Permalink
Browse files

#8 Upgrade header is case insensitive

  • Loading branch information...
1 parent b3d3ea9 commit 3cee130e488e4a5f66aaf691da45730f15817ced @majek majek committed Oct 11, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/sockjs_cowboy_handler.erl
@@ -12,9 +12,15 @@
init({tcp, http}, Req, {Handler, _WsHandler}) ->
{Upgrade, Req1} = cowboy_http_req:header('Upgrade', Req),
- case Upgrade of
- <<"WebSocket">> -> {upgrade, protocol, cowboy_http_websocket};
- _ -> {ok, Req1, #state{handler = Handler}}
+ Upgrade1 = case Upgrade of
+ B when is_binary(B) -> string:to_lower(binary_to_list(B));
+ X -> X
+ end,
+ case Upgrade1 of
+ "websocket" ->
+ {upgrade, protocol, cowboy_http_websocket};
+ _ ->
+ {ok, Req1, #state{handler = Handler}}
end.
handle(Req, State = #state{handler = Handler}) ->

0 comments on commit 3cee130

Please sign in to comment.