|
|
|
|
@ -94,6 +94,19 @@ if os.environ.get('IPYTHON_ALLOW_DRAFT_WEBSOCKETS_FOR_PHANTOMJS', False):
|
|
|
|
|
|
|
|
|
|
class ZMQStreamHandler(WebSocketHandler):
|
|
|
|
|
|
|
|
|
|
if tornado.version_info < (4,1):
|
|
|
|
|
"""Backport send_error from tornado 4.1 to 4.0"""
|
|
|
|
|
def send_error(self, *args, **kwargs):
|
|
|
|
|
if self.stream is None:
|
|
|
|
|
super(WebSocketHandler, self).send_error(*args, **kwargs)
|
|
|
|
|
else:
|
|
|
|
|
# If we get an uncaught exception during the handshake,
|
|
|
|
|
# we have no choice but to abruptly close the connection.
|
|
|
|
|
# TODO: for uncaught exceptions after the handshake,
|
|
|
|
|
# we can close the connection more gracefully.
|
|
|
|
|
self.stream.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_origin(self, origin):
|
|
|
|
|
"""Check Origin == Host or Access-Control-Allow-Origin.
|
|
|
|
|
|
|
|
|
|
|