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:
commit
7511f3d192
|
@ -35,6 +35,13 @@ def init(%{qs: qs} = req, state) do
|
||||||
{_, stream} <- List.keyfind(params, "stream", 0),
|
{_, stream} <- List.keyfind(params, "stream", 0),
|
||||||
{:ok, user} <- allow_request(stream, [access_token, sec_websocket]),
|
{:ok, user} <- allow_request(stream, [access_token, sec_websocket]),
|
||||||
topic when is_binary(topic) <- expand_topic(stream, params) do
|
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}}
|
{:cowboy_websocket, req, %{user: user, topic: topic}, %{idle_timeout: @timeout}}
|
||||||
else
|
else
|
||||||
{:error, code} ->
|
{:error, code} ->
|
||||||
|
|
Loading…
Reference in a new issue