Commit Graph

39 Commits

Author SHA1 Message Date
Min RK
1cac03528b use single WebSocket connection for all channels
multiplex on a 'channel' key in message,
rather than separate websockets.

Unlike zmq, there aren't different message patterns that require the channels to be separate.

Reduces FD count by factor of 3 and connection complexity in js.
2015-01-06 11:15:15 -08:00
MinRK
1ec9cfc25c use IOLoop.current in a few places
better allow notebook server to run in a thread
2014-12-08 15:47:56 -08:00
Min RK
19bcc5fed9 bump minimum tornado version to 4.0
remove various websocket workaround for tornado 3
2014-11-07 22:39:25 -08:00
Min RK
f8d59bcd9e forward-port draft76 websockets
from tornado-3.2.2

only enabled during testing with phantomjs
2014-11-07 22:39:24 -08:00
Matthias Bussonnier
63d4534959 Get pre_get to work and make session logs when adapter changes 2014-11-01 19:39:40 +01:00
Min RK
e5b135a905 debugging websocket connections
- add debug statement at the very beginning of a web socket request
- add debug statement in open, indicating that the connection has been accepted
- add timeout, so failed or slow kernel_info doesn't cause the request to never get a response
- don't send kernel_info_request before authenticating the request

The last one required some icky coroutine shenanigans,
because of our subclass structure, but it should work fine.
2014-10-29 09:17:52 -07:00
MinRK
94d6196ef9 add websocket workarounds for tornado 3
WebSocketHandler.get is new in tornado 4
2014-10-26 19:06:48 -07:00
MinRK
769fe38789 cache kernel_info reply for protocol adaptation
WebSocket connections will not open until kernel_info is retrieved,
removing a race condition waiting for the reply to indicate adaptation,
which could result in a v5 message being sent to a v4 kernel.
The reply is cached, so that it need not be requested on each new connection.
2014-10-26 14:48:55 -07:00
MinRK
8c743d304f unsigned ints for offsets
because signed ints for sizes is icky
2014-10-15 12:23:33 -07:00
MinRK
3de7e9bd74 test websocket-friendly binary message roundtrip
Python-side
2014-10-15 12:23:33 -07:00
MinRK
3693ac83ae support binary message from javascript 2014-10-15 12:23:32 -07:00
MinRK
c9c131ebf9 s/unserialize/deserialize 2014-10-15 12:23:32 -07:00
MinRK
3a1c845f96 support buffers in comm messages
- add buffers arg to comm Python api
- support binary websocket messages when buffers are present
- reimplement utf8 in javascript, because javascript is the best
2014-10-15 12:23:31 -07:00
MinRK
97f7116624 allow session_id to be undefined when starting kernel channels 2014-10-12 14:55:01 -07:00
MinRK
624f0071a2 remove on_first_message authentication
in ZMQStreams. No need for weird, special first message.

- use regular cookie auth
- use url param for session id
2014-10-09 15:12:20 -07:00
MinRK
4bc339bd95 better log messages when rejecting cross-origin requests 2014-09-16 15:38:41 -07:00
MinRK
d06e337881 only compare host:port in Websocket.check_origin
don't include protocol

- matches tornado's own behavior
- avoids incorrect 403 in http-behind-https proxy situations.
2014-09-15 17:17:08 -07:00
Richard Everson
be80e62340 Check time of last ping before timing out a missing pong. 2014-09-14 23:22:05 +01:00
MinRK
b3b168648a close websocket connections on ping/pong timeout
we recently added ws pings for keep alive,
and we can now use the longs to close dead connections.

This can apparently happen when connections are not closed cleanly,
e.g. on VPNs.

Setting ws_ping_timeout = 0 disables the ping mechanism altogether.
2014-08-13 11:32:25 -07:00
MinRK
52840fcbf8 send ping every 30 seconds to keep websockets alive 2014-07-23 16:17:07 -07:00
MinRK
1edc97e34a s/cors_/allow_/
add notes about Tornado 4, and comments, updates per review
2014-06-30 10:40:31 -07:00
MinRK
acf0da01d9 make CORS configurable
allows setting CORS headers.

- cors_origin sets Access-Control-Allow-Origin directly
- cors_origin_pat allows setting Access-Control-Allow-Origin via regular expression, since the header spec itself doesn’t support complex access[1]
- cors_credentials sets Access-Control-Allow-Credentials: true

To allow CORS from everywhere:

    ipython notebook —NotebookApp.cors_origin='*'
2014-06-27 17:47:56 -07:00
MinRK
44d2a5b62a only use zmq.jsonapi when talking to zmq sockets
use stdlib json otherwise
2014-06-18 13:41:40 -07:00
Steven Anton
f937045395 Set kernel_id before checking websocket
If websocket attempt fails and cross origin attempt is detected, a HTTPError(404) error is raised. However, in the process of closing connections because of this 404 error, an unhandled Attribute exception (kernel_id not an attribute) is raised. Setting the kernel_id first avoids this.
2014-06-17 12:29:55 -07:00
MinRK
b06f382e9b interrogate kernel_info to get protocol version for adaptation 2014-05-09 12:04:08 -07:00
Kyle Kelley
ddc9340a6a Handle variations of name for origin 2014-01-24 00:19:59 -06:00
Kyle Kelley
e06f501cd6 s/==/is/ 2014-01-22 21:12:08 -06:00
Kyle Kelley
7efc751d0e Name change to same_origin 2014-01-22 18:26:15 -06:00
Kyle Kelley
60ab030e52 Verify that headers are set, explicitly 2014-01-22 18:21:02 -06:00
Kyle Kelley
b12f002b35 Performing check only on open. 2014-01-22 18:16:06 -06:00
Kyle Kelley
345de4e674 Use *args, **kwargs, log.warn 2014-01-21 21:08:24 -06:00
Kyle Kelley
104275ab73 Indicate Py3 vs. Py2 codepath. 2014-01-21 14:47:58 -06:00
Kyle Kelley
5800b1c625 Get rid of exc_info as there isn't an exception. 2014-01-21 13:23:09 -06:00
Kyle Kelley
7b552d862d Add Origin Checking. 2014-01-21 12:55:52 -06:00
Thomas Kluyver
51040fb768 Update imports for Python 3
2to3 fixer imports (+ manual changes)
2013-10-29 09:15:54 -07:00
MinRK
638c36a7f7 fix some unicode in zmqhandlers
prevented session identity from being set properly,
which in turn prevented stdin from working in the notebook in Python 3.

closes #3494
2013-07-12 18:47:56 -07:00
MinRK
88668e65f8 don't use parent=self in handlers
handlers aren't configurable, so shouldn't be passed as parent.

closes #3502
2013-07-01 10:55:48 -07:00
MinRK
bd03a99e28 use parent=self throughout IPython
instead of `config=self.config`

only real effective change: IPythonKernelApp.parent has been renamed to IPKernelApp.parent_handle.
2013-06-29 12:41:17 -07:00
MinRK
cf726d6a40 mv IPython.html.notebook -> IPython.html 2013-06-27 11:14:10 -07:00