Skip to content
Myr

Added MAX_CONTENT_LENGTH config key

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent f8f8463 · Browse files · 4 files+18 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+18 added−1 removed

  • other:+18 added−1 removed

4 files+18 added−1 removed

modified:docs/config.rst+6 added
60 unmodified lines
61``USE_X_SENDFILE`` enable/disable x-sendfile62``LOGGER_NAME`` the name of the logger63``SERVER_NAME`` the name of the server. Required for64 subdomain support (eg: ``'localhost'``)65``MAX_CONTENT_LENGTH`` If set to a value in bytes, Flask will66 reject incoming requests with a67 content length greater than this by68 returning a 413 status code.69=============================== =========================================7071.. admonition:: More on ``SERVER_NAME``72
19 unmodified lines
9293.. versionadded:: 0.594 ``SERVER_NAME``9596.. versionadded:: ``MAX_CONTENT_LENGTH``9798Configuring from Files99----------------------100101Configuration becomes more useful if you can configure from a file, and
126 unmodified lines
modified:flask/app.py+2 added-1 removed
191 unmodified lines
192 'SESSION_COOKIE_NAME': 'session',193 'PERMANENT_SESSION_LIFETIME': timedelta(days=31),194 'USE_X_SENDFILE': False,195 'LOGGER_NAME': None,196 'SERVER_NAME': None196 'SERVER_NAME': None,197 'MAX_CONTENT_LENGTH': None198 })199200 def __init__(self, import_name, static_path=None):201 _PackageBoundObject.__init__(self, import_name)
656 unmodified lines
modified:flask/wrappers.py+8 added
11 unmodified lines
12from werkzeug import Request as RequestBase, Response as ResponseBase, \13 cached_property1415from .helpers import json, _assert_have_json16from .globals import _request_ctx_stack171819class Request(RequestBase):20 """The request object used by default in flask. Remembers the
21 unmodified lines
42 #: something similar.43 routing_exception = None4445 @property46 def max_content_length(self):47 """Read-only view of the `MAX_CONTENT_LENGTH` config key."""48 ctx = _request_ctx_stack.top49 if ctx is not None:50 return ctx.app.config['MAX_CONTENT_LENGTH']5152 @property53 def endpoint(self):54 """The endpoint that matched the request. This in combination with55 :attr:`view_args` can be used to reconstruct the same or a56 modified URL. If an exception happened when matching, this will
32 unmodified lines
modified:CHANGES+2 added
19 unmodified lines
20- the :attr:`~flask.Flask.config` is now available in the templates21 as `config`.22- context processors will no longer override values passed directly23 to the render function.24- added the ability to limit the incoming request data with the25 new ``MAX_CONTENT_LENGTH`` configuration value.2627Version 0.5.128-------------29
98 unmodified lines