]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
websocket_connect: don't hang on HTTP errors
authorVadim Semenov <protoss.player@gmail.com>
Mon, 1 Apr 2013 23:03:12 +0000 (03:03 +0400)
committerVadim Semenov <protoss.player@gmail.com>
Mon, 1 Apr 2013 23:03:12 +0000 (03:03 +0400)
tornado/websocket.py

index aac477371d3859ff3b57673c933a8eab00b90ae3..cd27d366ae2bf871473212e4aab316988fb24b98 100644 (file)
@@ -746,6 +746,9 @@ class WebSocketClientConnection(simple_httpclient._HTTPConnection):
     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'