@@ -240,11 +240,6 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
240240 iopub_data_rate_limit = jupyter_app .iopub_data_rate_limit ,
241241 rate_limit_window = jupyter_app .rate_limit_window ,
242242
243- # maximum request sizes - support saving larger notebooks
244- # tornado defaults are 100 MiB, we increase it to 0.5 GiB
245- max_body_size = 512 * 1024 * 1024 ,
246- max_buffer_size = 512 * 1024 * 1024 ,
247-
248243 # authentication
249244 cookie_secret = jupyter_app .cookie_secret ,
250245 login_url = url_path_join (base_url ,'/login' ),
@@ -780,6 +775,24 @@ def _token_default(self):
780775 self ._token_generated = True
781776 return binascii .hexlify (os .urandom (24 )).decode ('ascii' )
782777
778+ max_body_size = Integer (512 * 1024 * 1024 , config = True ,
779+ help = """
780+ Sets the maximum allowed size of the client request body, specified in
781+ the Content-Length request header field. If the size in a request
782+ exceeds the configured value, a malformed HTTP message is returned to
783+ the client.
784+
785+ Note: max_body_size is applied even in streaming mode.
786+ """
787+ )
788+
789+ max_buffer_size = Integer (512 * 1024 * 1024 , config = True ,
790+ help = """
791+ Gets or sets the maximum amount of memory, in bytes, that is allocated
792+ for use by the buffer manager.
793+ """
794+ )
795+
783796 @observe ('token' )
784797 def _token_changed (self , change ):
785798 self ._token_generated = False
@@ -1385,7 +1398,9 @@ def init_webapp(self):
13851398
13861399 self .login_handler_class .validate_security (self , ssl_options = ssl_options )
13871400 self .http_server = httpserver .HTTPServer (self .web_app , ssl_options = ssl_options ,
1388- xheaders = self .trust_xheaders )
1401+ xheaders = self .trust_xheaders ,
1402+ max_body_size = self .max_body_size ,
1403+ max_buffer_size = self .max_buffer_size )
13891404
13901405 success = None
13911406 for port in random_ports (self .port , self .port_retries + 1 ):
0 commit comments