Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#8 Upgrade header is case insensitive

  • Loading branch information...
commit 3cee130e488e4a5f66aaf691da45730f15817ced 1 parent b3d3ea9
@majek majek authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/sockjs_cowboy_handler.erl
View
12 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}) ->
Please sign in to comment.
Something went wrong with that request. Please try again.