mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-13 13:17:50 +08:00
allow zmq check_origin with no args
terminado may call `self.check_origin()` in which case we should grab origin from the headers.
This commit is contained in:
parent
bf6c89b1ce
commit
8aa4f1e60c
@ -121,7 +121,7 @@ class WebSocketMixin(object):
|
||||
max(3 * self.ping_interval, WS_PING_INTERVAL)
|
||||
)
|
||||
|
||||
def check_origin(self, origin):
|
||||
def check_origin(self, origin=None):
|
||||
"""Check Origin == Host or Access-Control-Allow-Origin.
|
||||
|
||||
Tornado >= 4 calls this method automatically, raising 403 if it returns False.
|
||||
@ -130,7 +130,9 @@ class WebSocketMixin(object):
|
||||
return True
|
||||
|
||||
host = self.request.headers.get("Host")
|
||||
|
||||
if origin is None:
|
||||
origin = self.get_origin()
|
||||
|
||||
# If no header is provided, assume we can't verify origin
|
||||
if origin is None:
|
||||
self.log.warn("Missing Origin header, rejecting WebSocket connection.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user