From 28b5bf18a3be3b933a76f8b8912c8ee55238cdc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?=
init(Req0, State) -> - case cowboy_req:parse_header(<<"sec-websocket-protocol">>, Req0) of +init(Req, State) -> + case cowboy_req:parse_header(<<"sec-websocket-protocol">>, Req) of undefined -> - {cowboy_websocket, Req0, State}; + {cowboy_websocket, Req, State}; Subprotocols -> case lists:keymember(<<"mqtt">>, 1, Subprotocols) of true -> - Req = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>, - <<"mqtt">>, Req0), - {cowboy_websocket, Req, State}; + Req2 = cowboy_req:set_resp_header(<<"sec-websocket-protocol">>, + <<"mqtt">>, Req), + {cowboy_websocket, Req2, State}; false -> - Req = cowboy_req:reply(400, Req0), - {ok, Req, State} + {stop, Req, State} end end.@@ -388,6 +387,8 @@ close frame will not be sent. +2.1 +2.0 1.0 -- cgit v1.2.3