-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Batch 1] Port Notebook PRs #95
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
11044cc
properly handle unicode characters in home dirs
vit-tucek a80d7f0
flush iopub before sending restarting/dead status messages
minrk cd79a98
[FIX] notebookapp, auth: `get_secure_cookie` kwargs
beledouxdenis 349045e
ip_address only accepts unicode on Python 2
minrk b145196
use localhost as default local hostname
minrk c09c9d6
Make the max_body_size & max_buffer_size configurable
mociarain 256b288
Correctly pass them to the underlying tornado server
mociarain f214666
Fix quotes and tidy up the help messages
mociarain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,7 +219,7 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager, | |
now = utcnow() | ||
|
||
root_dir = contents_manager.root_dir | ||
home = os.path.expanduser('~') | ||
home = py3compat.str_to_unicode(os.path.expanduser('~'), encoding=sys.getfilesystemencoding()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if root_dir.startswith(home + os.path.sep): | ||
# collapse $HOME to ~ | ||
root_dir = '~' + root_dir[len(home):] | ||
|
@@ -245,11 +245,6 @@ def init_settings(self, jupyter_app, kernel_manager, contents_manager, | |
iopub_data_rate_limit=jupyter_app.iopub_data_rate_limit, | ||
rate_limit_window=jupyter_app.rate_limit_window, | ||
|
||
# maximum request sizes - support saving larger notebooks | ||
# tornado defaults are 100 MiB, we increase it to 0.5 GiB | ||
max_body_size = 512 * 1024 * 1024, | ||
max_buffer_size = 512 * 1024 * 1024, | ||
|
||
# authentication | ||
cookie_secret=jupyter_app.cookie_secret, | ||
login_url=url_path_join(base_url, '/login'), | ||
|
@@ -775,6 +770,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, a malformed HTTP message is returned to | ||
the client. | ||
|
||
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 buffer manager. | ||
""" | ||
) | ||
|
||
@observe('token') | ||
def _token_changed(self, change): | ||
self._token_generated = False | ||
|
@@ -931,6 +944,10 @@ def _default_allow_remote(self): | |
help=_("Extra keyword arguments to pass to `set_secure_cookie`." | ||
" See tornado's set_secure_cookie docs for details.") | ||
) | ||
get_secure_cookie_kwargs = Dict(config=True, | ||
help=_("Extra keyword arguments to pass to `get_secure_cookie`." | ||
" See tornado's get_secure_cookie docs for details.") | ||
) | ||
ssl_options = Dict(config=True, | ||
help=_("""Supply SSL options for the tornado HTTPServer. | ||
See the tornado docs for details.""")) | ||
|
@@ -1247,6 +1264,7 @@ def init_webapp(self): | |
self.tornado_settings['allow_origin_pat'] = re.compile(self.allow_origin_pat) | ||
self.tornado_settings['allow_credentials'] = self.allow_credentials | ||
self.tornado_settings['cookie_options'] = self.cookie_options | ||
self.tornado_settings['get_secure_cookie_kwargs'] = self.get_secure_cookie_kwargs | ||
self.tornado_settings['token'] = self.token | ||
if (self.open_browser or self.file_to_run) and not self.password: | ||
self.one_time_token = binascii.hexlify(os.urandom(24)).decode('ascii') | ||
|
@@ -1289,7 +1307,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): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(#96) We dropped support for Python 2 in #94.