@@ -240,11 +240,6 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager,
240
240
iopub_data_rate_limit = jupyter_app .iopub_data_rate_limit ,
241
241
rate_limit_window = jupyter_app .rate_limit_window ,
242
242
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
-
248
243
# authentication
249
244
cookie_secret = jupyter_app .cookie_secret ,
250
245
login_url = url_path_join (base_url ,'/login' ),
@@ -780,6 +775,24 @@ def _token_default(self):
780
775
self ._token_generated = True
781
776
return binascii .hexlify (os .urandom (24 )).decode ('ascii' )
782
777
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
+
783
796
@observe ('token' )
784
797
def _token_changed (self , change ):
785
798
self ._token_generated = False
@@ -1385,7 +1398,9 @@ def init_webapp(self):
1385
1398
1386
1399
self .login_handler_class .validate_security (self , ssl_options = ssl_options )
1387
1400
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 )
1389
1404
1390
1405
success = None
1391
1406
for port in random_ports (self .port , self .port_retries + 1 ):
0 commit comments