http: Allow WebSocket requests from other hosts

This makes Tornado 4.0 behavior consistent with previous Tornado versions.

Fixes #788
This commit is contained in:
Stein Magnus Jodal 2014-07-25 10:52:39 +02:00
parent c48103f1d2
commit 6ed8132f76
2 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,18 @@ Changelog
This changelog is used to track all major changes to Mopidy.
v0.19.2 (UNRELEASED)
====================
Bug fix release.
**HTTP**
- When using Tornado 4.0, allow WebSocket requests from other hosts. (Fixes:
:issue:`788`)
v0.19.1 (2014-07-23)
====================

View File

@ -112,6 +112,11 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler):
logger.error('WebSocket request error: %s', e)
self.close()
def check_origin(self, origin):
# Allow cross-origin WebSocket connections, like Tornado before 4.0
# defaulted to.
return True
def set_mopidy_headers(request_handler):
request_handler.set_header('Cache-Control', 'no-cache')