mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
remove max_msg_size altogether
It was a security feature without an application.
This commit is contained in:
parent
4408ab6ca1
commit
39578beabc
@ -174,7 +174,6 @@ class NotebookWebApplication(web.Application):
|
||||
|
||||
# IPython stuff
|
||||
mathjax_url=ipython_app.mathjax_url,
|
||||
max_msg_size=ipython_app.max_msg_size,
|
||||
config=ipython_app.config,
|
||||
use_less=ipython_app.use_less,
|
||||
jinja2_env=Environment(loader=FileSystemLoader(template_path)),
|
||||
@ -295,11 +294,6 @@ class NotebookApp(BaseIPythonApplication):
|
||||
|
||||
kernel_argv = List(Unicode)
|
||||
|
||||
max_msg_size = Integer(2**20, config=True, help="""
|
||||
The max raw message size (in bytes) accepted from the browser
|
||||
over a WebSocket connection.
|
||||
""")
|
||||
|
||||
def _log_level_default(self):
|
||||
return logging.INFO
|
||||
|
||||
|
@ -79,10 +79,6 @@ class KernelActionHandler(IPythonHandler):
|
||||
|
||||
class ZMQChannelHandler(AuthenticatedZMQStreamHandler):
|
||||
|
||||
@property
|
||||
def max_msg_size(self):
|
||||
return self.settings.get('max_msg_size', 2**20)
|
||||
|
||||
def create_stream(self):
|
||||
km = self.kernel_manager
|
||||
meth = getattr(km, 'connect_%s' % self.channel)
|
||||
@ -109,13 +105,8 @@ class ZMQChannelHandler(AuthenticatedZMQStreamHandler):
|
||||
self.zmq_stream.on_recv(self._on_zmq_reply)
|
||||
|
||||
def on_message(self, msg):
|
||||
if len(msg) < self.max_msg_size:
|
||||
msg = jsonapi.loads(msg)
|
||||
self.session.send(self.zmq_stream, msg)
|
||||
else:
|
||||
self.log.warn("Dropping oversized message: %iB > %iB (NotebookApp.max_msg_size)",
|
||||
len(msg), self.max_msg_size
|
||||
)
|
||||
|
||||
def on_close(self):
|
||||
# This method can be called twice, once by self.kernel_died and once
|
||||
|
Loading…
Reference in New Issue
Block a user