Commit Graph

138 Commits

Author SHA1 Message Date
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
Matthias Bussonnier
e7c2c369e0 Add about dialog in Notebook Help Menu.
This allow to get info on version of IPython when running remotely.
The about dialog also send a kernel info request and display the banner
which is useful for non-python kernel that don't match IPython version
2014-10-16 17:04:19 +02: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
Min RK
1b5874ac65 Merge pull request #6629 from minrk/wscookie
remove on_first_message authentication
2014-10-12 13:25:52 -07:00
Bussonnier Matthias
76a54f0a82 Have /api return the IPython version
return version as a string, to be consistent with other APIs.

closes #6647
2014-10-10 19:28:04 +02: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
Thomas Kluyver
7e681c1c53 Merge pull request #6302 from minrk/ws-heartbeat-timeout
close websocket connections on ping/pong timeout
2014-09-04 15:21:25 -07:00
MinRK
568034c349 use write_error instead of get_error_html
get_error_html is removed in tornado 4.0
2014-08-15 13:41:13 -07: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
fae77bd133 remove unused project_dir 2014-07-31 11:57:38 -07:00
MinRK
d4fe081fe5 move /files/ redirect to base handlers
and reuse it in /nbconvert/html/…

closes #6137
2014-07-31 11:57:37 -07:00
MinRK
0c0eb43719 teach contents service about non-notebook files 2014-07-31 11:57:36 -07:00
MinRK
6cce477e07 rename notebooks service to contents service
minimal functional changes, committing because tests are passing.
2014-07-31 11:57:36 -07:00
Thomas Kluyver
a5b145e5a2 Merge pull request #6139 from minrk/wsping
send ping every 30 seconds to keep websockets alive
2014-07-24 18:55:18 -07:00
MinRK
52840fcbf8 send ping every 30 seconds to keep websockets alive 2014-07-23 16:17:07 -07:00
MinRK
579f5101f0 restore websocket_url configurable
allows ws to be handled via separate proxies,
as appears to be the case on OpenShift and some other hosting services.
2014-07-22 14:43:40 -07:00
rgbkrk
88e52b2746 Only allow iframe embedding on same origin. 2014-07-12 00:20:24 -05: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
de0a7d7850 use utils.log.get_logger where appropriate 2014-06-24 20:16:46 -07:00
Thomas Kluyver
3b92c7c24f Merge pull request #6011 from minrk/no-jsonapi
only use zmq.jsonapi when talking to zmq sockets
2014-06-18 14:45:31 -07:00
Min RK
99f52dee68 Merge pull request #5827 from takluyver/kernelspec-rest-api
Kernel specs REST API
2014-06-18 13:53:41 -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
Thomas Kluyver
02fa348c69 Create REST API for kernel specs 2014-05-08 16:18:23 -07:00
MinRK
f824aee955 log error message when API requests fail 2014-04-23 12:41:27 -07:00
Paul Ivanov
d6f2dfefea log refusal to serve hidden files dirs 2014-03-03 12:35:37 -08:00
Matthias BUSSONNIER
a01c112b0f allow custom headers on all pages 2014-03-01 09:43:27 +01:00
MinRK
37cb0fbdee remove websocket url
websockets should follow the kernel URL

(normal behavior is unchanged, only unused configurability is removed)
2014-02-20 22:54:36 -08:00
MinRK
a184724bdb remove base_kernel_url 2014-02-11 21:26:10 -08:00
MinRK
e1e0b19a6a s/base_project_url/base_url/
deprecate NotebookApp.base_project_url
2014-02-08 23:09:24 -08:00
Brian E. Granger
eb9e0be218 Small refactoring of is_hidden to take root as default kwarg. 2014-02-05 16:43:11 -08:00
Brian E. Granger
0c794b5d2c 404 for hidden files to not revleal their existence. 2014-02-05 15:38:34 -08:00
Brian E. Granger
243392d810 Creating and testing IPython.html.utils.is_hidden. 2014-02-05 13:09:55 -08: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
MinRK
063bfa9688 we don't bundle lessc anymore, remove its vestiges 2014-01-13 16:17:50 -08:00
Thomas Kluyver
c0f346c4e3 Merge pull request #4735 from minrk/better-errors
add some HTML error pages
2014-01-09 13:03:31 -08:00
MinRK
b7563aec7c be more specific about unknown status codes
per review
2014-01-07 15:16:13 -08:00
MinRK
9865c4f02f whitelist alphanumeric characters for cookie_name
should fix #4761
2014-01-06 14:57:34 -08:00
Min RK
96c1af0ce4 Merge pull request #4715 from minrk/tornado-static-url
restore use of tornado static_url in templates
2013-12-31 10:58:09 -08:00
MinRK
b62da23660 render custom HTML for error pages 2013-12-22 17:46:41 -08:00
Thomas Kluyver
57642b3847 Move notebook URL fragment regexen into IPython.html.base.handlers 2013-12-19 13:01:00 -08:00
MinRK
fd0e9e865c don't raise 404 in get_absolute_path
raise in validate_absolute_path, where it belongs
2013-12-18 14:18:09 -08:00
MinRK
15780ad055 restore use of tornado static_url
instead of jinja macro that doesn't write hashes

closes #4714
2013-12-18 14:17:35 -08:00
Thomas Kluyver
51040fb768 Update imports for Python 3
2to3 fixer imports (+ manual changes)
2013-10-29 09:15:54 -07:00
Thomas Kluyver
4a14ed7e22 Replace references to unicode and basestring 2013-10-29 09:15:54 -07:00
Min RK
4e8bc066e9 Merge pull request #4435 from minrk/tornado-tweaks
raise 404 on not found static file
2013-10-27 13:12:08 -07:00
MinRK
7ea4db6c48 don't compute etags in static file handlers
etags skip cache timing, which we probably don't want.  If-Modified-Since is good enough for us.
2013-10-24 14:25:15 -07:00
MinRK
ff744e25cd raise 404 on not found static file
master gives 403 due to empty string being outside of root
2013-10-24 11:14:50 -07:00
MinRK
6fa13ebb98 bump minimum tornado version to 3.1.0
The no-hidden behavior of the files handler
already requires this, but instead of raising, it just doesn't hide hidden files.

Bumping the minimum version also allows much cleaner static file handler subclasses.
2013-10-23 14:04:35 -07:00
MinRK
ede0297874 tweak stat walk in forbid_hidden 2013-10-22 17:41:53 -07:00
MinRK
40cce4d7e3 s/os.path.sep/os.sep/ 2013-10-22 17:36:34 -07:00
MinRK
dbfea55e8a stat has no st_flags on Windows (maybe elsewhere?) 2013-10-22 17:16:31 -07:00
MinRK
2fcc7fe97f forbid serving hidden files from /files 2013-10-22 15:20:27 -07:00
Brian E. Granger
51fc769edd Handle notebook downloads through the /files URL. 2013-10-17 14:09:20 -07:00
MinRK
821514bd72 cleanup weird 404 2013-10-17 14:09:18 -07:00
MinRK
83114a11d8 add TrailingSlashHandler
redirects all GET requests with a trailing slash
2013-10-17 14:09:15 -07:00
MinRK
c21ea96476 log exceptions parsing JSON 2013-10-17 14:09:14 -07:00
MinRK
cded90efe3 update json_errors decorator
separate handling of HTTPError and unhanded exceptions
2013-10-17 14:09:13 -07:00
Zachary Sailer
c26700cd3a changes after session manager code review 2013-10-17 14:09:12 -07:00
MinRK
14fd50f80b Simplify Tree handlers
- 404 on missing path
- only need one handler for each of redirect and dashboard,
  don't need duplicates.
- project property on Handlers is unclear
2013-10-17 14:09:12 -07:00
Brian E. Granger
2d6f4628c4 Adding JSON error handling and fixing location headers. 2013-10-17 14:09:10 -07:00
Zachary Sailer
050a3098a8 review fixes on tests, add extra kernel api test 2013-10-17 14:09:10 -07:00
Zachary Sailer
91f25dc046 add contents web service api 2013-10-17 14:09:05 -07:00
Zachary Sailer
521f03793a manual rebase base/handlers.py 2013-10-17 14:07:48 -07:00
MinRK
f9dd129e1c remove notebook read-only view
it is largely broken, and had problematic security issues.
2013-07-23 13:22:05 -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