diff --git a/IPython/html/base/zmqhandlers.py b/IPython/html/base/zmqhandlers.py index 3b72c86..7eec55b 100644 --- a/IPython/html/base/zmqhandlers.py +++ b/IPython/html/base/zmqhandlers.py @@ -202,12 +202,6 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler): Extend this method to add logic that should fire before the websocket finishes completing. """ - # Check to see that origin matches host directly, including ports - # Tornado 4 already does CORS checking - if tornado.version_info[0] < 4: - if not self.check_origin(self.get_origin()): - raise web.HTTPError(403) - # authenticate the request before opening the websocket if self.get_current_user() is None: self.log.warn("Couldn't authenticate WebSocket connection") @@ -224,10 +218,7 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler): # assign and yield in two step to avoid tornado 3 issues res = self.pre_get() yield gen.maybe_future(res) - # FIXME: only do super get on tornado ≥ 4 - # tornado 3 has no get, will raise 405 - if tornado.version_info >= (4,): - super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs) + super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs) def initialize(self): self.log.debug("Initializing websocket connection %s", self.request.path) @@ -235,12 +226,6 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler): def open(self, *args, **kwargs): self.log.debug("Opening websocket %s", self.request.path) - if tornado.version_info < (4,): - try: - self.get(*self.open_args, **self.open_kwargs) - except web.HTTPError: - self.close() - raise # start the pinging if self.ping_interval > 0: diff --git a/IPython/html/notebookapp.py b/IPython/html/notebookapp.py index b6b41bb..f9fb654 100644 --- a/IPython/html/notebookapp.py +++ b/IPython/html/notebookapp.py @@ -35,7 +35,7 @@ from zmq.eventloop import ioloop ioloop.install() # check for tornado 3.1.0 -msg = "The IPython Notebook requires tornado >= 3.1.0" +msg = "The IPython Notebook requires tornado >= 4.0" try: import tornado except ImportError: @@ -44,7 +44,7 @@ try: version_info = tornado.version_info except AttributeError: raise ImportError(msg + ", but you have < 1.1.0") -if version_info < (3,1,0): +if version_info < (4,0): raise ImportError(msg + ", but you have %s" % tornado.version) from tornado import httpserver diff --git a/IPython/html/terminal/handlers.py b/IPython/html/terminal/handlers.py index 20e0fa7..bbb8e4a 100644 --- a/IPython/html/terminal/handlers.py +++ b/IPython/html/terminal/handlers.py @@ -27,22 +27,9 @@ class TermSocket(terminado.TermSocket, IPythonHandler): def get(self, *args, **kwargs): if not self.get_current_user(): raise web.HTTPError(403) - - # FIXME: only do super get on tornado ≥ 4 - # tornado 3 has no get, will raise 405 - if tornado.version_info >= (4,): - return super(TermSocket, self).get(*args, **kwargs) + return super(TermSocket, self).get(*args, **kwargs) def clear_cookie(self, *args, **kwargs): """meaningless for websockets""" pass - def open(self, *args, **kwargs): - if tornado.version_info < (4,): - try: - self.get(*self.open_args, **self.open_kwargs) - except web.HTTPError: - self.close() - raise - - super(TermSocket, self).open(*args, **kwargs) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 125f9cf..54ac454 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -132,7 +132,7 @@ have['pymongo'] = test_for('pymongo') have['pygments'] = test_for('pygments') have['qt'] = test_for('IPython.external.qt') have['sqlite3'] = test_for('sqlite3') -have['tornado'] = test_for('tornado.version_info', (3,1,0), callback=None) +have['tornado'] = test_for('tornado.version_info', (4,0), callback=None) have['jinja2'] = test_for('jinja2') have['mistune'] = test_for('mistune') have['requests'] = test_for('requests') diff --git a/setup.py b/setup.py index 931d216..d4478b3 100755 --- a/setup.py +++ b/setup.py @@ -276,7 +276,7 @@ extras_require = dict( test = ['nose>=0.10.1', 'requests'], terminal = [], nbformat = ['jsonschema>=2.0'], - notebook = ['tornado>=3.1', 'pyzmq>=2.1.11', 'jinja2', 'pygments', 'mistune>=0.3.1'], + notebook = ['tornado>=4.0', 'pyzmq>=2.1.11', 'jinja2', 'pygments', 'mistune>=0.3.1'], nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1'] )