Skip to content

Commit

Permalink
websocket_connect: don't hang on HTTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
protoss-player committed Apr 1, 2013
1 parent 85478c5 commit a69a43b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tornado/websocket.py
Expand Up @@ -746,6 +746,9 @@ def __init__(self, io_loop, request):
def _on_close(self):
self.on_message(None)

def _on_body(self, body):
self.connect_future.set_exception(Exception('Could not connect.'))

def _handle_1xx(self, code):
assert code == 101
assert self.headers['Upgrade'].lower() == 'websocket'
Expand Down

0 comments on commit a69a43b

Please sign in to comment.