log remote id if versions do not match, allow file:// to access websocket

This commit is contained in:
j 2016-01-17 20:30:19 +05:30
parent 954491759e
commit 9c1c653582
2 changed files with 2 additions and 2 deletions

View File

@ -193,7 +193,7 @@ class Node(Thread):
version = r.headers.get('X-Node-Protocol', None)
if version != settings.NODE_PROTOCOL:
logger.debug('version does not match local: %s remote %s', settings.NODE_PROTOCOL, version)
logger.debug('version does not match local: %s remote %s (%s)', settings.NODE_PROTOCOL, version, self.user_id)
self.online = False
if version > settings.NODE_PROTOCOL:
state.update_required = True

View File

@ -28,7 +28,7 @@ class Handler(WebSocketHandler):
)
def open(self):
if self.request.headers['origin'] not in ('null', 'http://127.0.0.1:9842') \
if self.request.headers['origin'] not in ('null', 'file://', 'http://127.0.0.1:9842') \
and self.request.host not in self.request.headers['origin']:
logger.debug('reject cross site attempt to open websocket %s', self.request)
self.close()