Skip to content

Commit

Permalink
Correctly pass them to the underlying tornado server
Browse files Browse the repository at this point in the history
  • Loading branch information
mociarain authored and kevin-bates committed Sep 25, 2019
1 parent b6f3e5b commit 9e04d24
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,24 @@ def _token_default(self):
self._token_generated = True
return binascii.hexlify(os.urandom(24)).decode('ascii')

max_body_size = Integer(512 * 1024 * 1024, config=True,
help="""
Sets the maximum allowed size of the client request body, specified in
the “Content-Length” request header field. If the size in a request
exceeds the configured value, returned to the client a
Malformed HTTP message is returned.
Note: max_body_size is applied even in streaming mode.
"""
)

max_buffer_size = Integer(512 * 1024 * 1024, config=True,
help="""
Gets or sets the maximum amount of memory, in bytes, that is allocated
for use by the manager of the buffers.
"""
)

@observe('token')
def _token_changed(self, change):
self._token_generated = False
Expand Down Expand Up @@ -1278,7 +1296,9 @@ def init_webapp(self):

self.login_handler_class.validate_security(self, ssl_options=ssl_options)
self.http_server = httpserver.HTTPServer(self.web_app, ssl_options=ssl_options,
xheaders=self.trust_xheaders)
xheaders=self.trust_xheaders,
max_body_size=self.max_body_size,
max_buffer_size=self.max_buffer_size)

success = None
for port in random_ports(self.port, self.port_retries+1):
Expand Down

0 comments on commit 9e04d24

Please sign in to comment.