mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
specify socket identity from kernel.js
required for stdin routing
This commit is contained in:
parent
510897f0aa
commit
74f8972505
@ -506,6 +506,12 @@ class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):
|
||||
# Cookie constructor doesn't accept unicode strings
|
||||
# under Python 2.x for some reason
|
||||
msg = msg.encode('utf8', 'replace')
|
||||
try:
|
||||
bsession, msg = msg.split(':', 1)
|
||||
self.session.session = bsession.decode('ascii')
|
||||
except Exception:
|
||||
logging.error("No bsession!", exc_info=True)
|
||||
pass
|
||||
try:
|
||||
self.request._cookies = Cookie.SimpleCookie(msg)
|
||||
except:
|
||||
@ -528,7 +534,7 @@ class ZMQChannelHandler(AuthenticatedZMQStreamHandler):
|
||||
def create_stream(self):
|
||||
km = self.kernel_manager
|
||||
meth = getattr(km, 'connect_%s' % self.channel)
|
||||
self.zmq_stream = meth(self.kernel_id)
|
||||
self.zmq_stream = meth(self.kernel_id, identity=self.session.bsession)
|
||||
|
||||
def initialize(self, *args, **kwargs):
|
||||
self.zmq_stream = None
|
||||
|
@ -129,7 +129,7 @@ var IPython = (function (IPython) {
|
||||
this.shell_channel = new this.WebSocket(ws_url + "/shell");
|
||||
this.iopub_channel = new this.WebSocket(ws_url + "/iopub");
|
||||
send_cookie = function(){
|
||||
this.send(document.cookie);
|
||||
this.send(that.session_id + ':' + document.cookie);
|
||||
};
|
||||
var already_called_onclose = false; // only alert once
|
||||
var ws_closed_early = function(evt){
|
||||
|
Loading…
Reference in New Issue
Block a user