Merge branch 'fix-streaming-with-sec-websocket-protocol' into 'develop'

Fix streaming websocket handshake with `Sec-WebSocket-Protocol`

See merge request pleroma/pleroma!1847
This commit is contained in:
kaniini 2019-10-18 04:42:02 +00:00
commit 7511f3d192

View file

@ -35,6 +35,13 @@ def init(%{qs: qs} = req, state) do
{_, stream} <- List.keyfind(params, "stream", 0),
{:ok, user} <- allow_request(stream, [access_token, sec_websocket]),
topic when is_binary(topic) <- expand_topic(stream, params) do
req =
if sec_websocket do
:cowboy_req.set_resp_header("sec-websocket-protocol", sec_websocket, req)
else
req
end
{:cowboy_websocket, req, %{user: user, topic: topic}, %{idle_timeout: @timeout}}
else
{:error, code} ->