Skip to content

Commit

Permalink
Set follow_redirects to False for websocket connections to prevent si…
Browse files Browse the repository at this point in the history
…lent failure on redirect

Partial fix for issue tornadoweb#2405
  • Loading branch information
vivamexico committed Jun 10, 2020
1 parent a99f147 commit 451f8ac
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tornado/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,10 @@ def websocket_connect(url, callback=None, connect_timeout=None,
request = httpclient.HTTPRequest(url, connect_timeout=connect_timeout)
request = httpclient._RequestProxy(
request, httpclient.HTTPRequest._DEFAULTS)

# Websocket connection is currently unable to follow redirects
# Set follow_redirects to False to prevent a silent failure
request.follow_redirects = False
conn = WebSocketClientConnection(request,
on_message_callback=on_message_callback,
compression_options=compression_options,
Expand Down

0 comments on commit 451f8ac

Please sign in to comment.