8000 specify socket identity from kernel.js · ipython/ipython@24dcb6b · GitHub
[go: up one dir, main page]

Skip to content

Commit 24dcb6b

Browse files
committed
specify socket identity from kernel.js
required for stdin routing
1 parent 8fae131 commit 24dcb6b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

IPython/frontend/html/notebook/handlers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,12 @@ def _inject_cookie_message(self, msg):
506506
# Cookie constructor doesn't accept unicode strings
507507
# under Python 2.x for some reason
508508
msg = msg.encode('utf8', 'replace')
509+
try:
510+
bsession, msg = msg.split(':', 1)
511+
self.session.session = bsession.decode('ascii')
512+
except Exception:
513+
logging.error("No bsession!", exc_info=True)
514+
pass
509515
try:
510516
self.request._cookies = Cookie.SimpleCookie(msg)
511517
except:
@@ -528,7 +534,7 @@ def max_msg_size(self):
528534
def create_stream(self):
529535
km = self.kernel_manager
530536
meth = getattr(km, 'connect_%s' % self.channel)
531-
self.zmq_stream = meth(self.kernel_id)
537+
self.zmq_stream = meth(self.kernel_id, identity=self.session.bsession)
532538

533539
def initialize(self, *args, **kwargs):
534540
self.zmq_stream = None

IPython/frontend/html/notebook/static/js/kernel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ var IPython = (function (IPython) {
129129
this.shell_channel = new this.WebSocket(ws_url + "/shell");
130130
this.iopub_channel = new this.WebSocket(ws_url + "/iopub");
131131
send_cookie = function(){
132-
this.send(document.cookie);
132+
this.send(that.session_id + ':' + document.cookie);
133133
};
134134
var already_called_onclose = false; // only alert once
135135
var ws_closed_early = function(evt){

0 commit comments

Comments
 (0)
0