summaryrefslogtreecommitdiff
path: root/django/core/handlers
Commit message (Collapse)AuthorAgeFilesLines
* Fixed #34484, Refs #34482 -- Reverted "Fixed #29186 -- Fixed pickling ↵Mariusz Felisiak2023-04-121-10/+0
| | | | | | | | HttpRequest and subclasses." This reverts commit 6220c445c40a6a7f4d442de8bde2628346153963. Thanks Adam Johnson and Márton Salomváry for reports.
* Fixed #34394 -- Added FORCE_SCRIPT_NAME handling to ASGIRequest.sarahboyce2023-04-121-10/+11
| | | | Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
* Fixed #33738 -- Allowed handling ASGI http.disconnect in long-lived requests.th3nn3ss2023-04-031-3/+38
|
* Fixed #32172 -- Adapted signals to allow async handlers.Jon Janzen2023-03-071-3/+1
| | | | | co-authored-by: kozzztik <kozzztik@mail.ru> co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
* Fixed CVE-2023-24580 -- Prevented DoS with too many uploaded files.Markus Holtermann2023-02-141-1/+2
| | | | Thanks to Jakob Ackermann for the report.
* Refs #34233 -- Used str.removeprefix()/removesuffix().Mariusz Felisiak2023-01-182-3/+3
|
* Refs #34233 -- Used aiter() and anext().Nick Pope2023-01-181-1/+1
| | | Available since Python 3.10.
* Fixed #34233 -- Dropped support for Python 3.8 and 3.9.Mariusz Felisiak2023-01-181-1/+1
|
* Fixed #33865 -- Optimized LimitedStream wrapper.Nick Pope2023-01-051-45/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of LimitedStream is slow because .read() performs an extra copy into a buffer and .readline() performs two extra copies. The stream being wrapped is already typically a BytesIO object so this is unnecessary. This implementation has largely been untouched for 12 years and, inspired by a simpler implementation in werkzeug, it was possible to achieve the following performance improvement: LimitedStream.read() (single line): Mean +- std dev: [bench_limitedstream-main] 286 ns +- 6 ns -> [bench_limitedstream-patch] 227 ns +- 6 ns: 1.26x faster LimitedStream.readline() (single line): Mean +- std dev: [bench_limitedstream-main] 507 ns +- 11 ns -> [bench_limitedstream-patch] 232 ns +- 8 ns: 2.18x faster LimitedStream.read(8192) (single line): Mean +- std dev: [bench_limitedstream-main] 360 ns +- 8 ns -> [bench_limitedstream-patch] 297 ns +- 6 ns: 1.21x faster LimitedStream.readline(8192) (single line): Mean +- std dev: [bench_limitedstream-main] 602 ns +- 10 ns -> [bench_limitedstream-patch] 305 ns +- 10 ns: 1.98x faster LimitedStream.read() (multiple lines): Mean +- std dev: [bench_limitedstream-main] 290 ns +- 5 ns -> [bench_limitedstream-patch] 236 ns +- 6 ns: 1.23x faster LimitedStream.readline() (multiple lines): Mean +- std dev: [bench_limitedstream-main] 517 ns +- 19 ns -> [bench_limitedstream-patch] 239 ns +- 7 ns: 2.16x faster LimitedStream.read(8192) (multiple lines): Mean +- std dev: [bench_limitedstream-main] 363 ns +- 8 ns -> [bench_limitedstream-patch] 311 ns +- 11 ns: 1.17x faster LimitedStream.readline(8192) (multiple lines): Mean +- std dev: [bench_limitedstream-main] 601 ns +- 12 ns -> [bench_limitedstream-patch] 308 ns +- 7 ns: 1.95x faster Geometric mean: 1.59x faster
* Fixed #33735 -- Added async support to StreamingHttpResponse.Carlton Gibson2022-12-221-13/+17
| | | | | Thanks to Florian Vazelle for initial exploratory work, and to Nick Pope and Mariusz Felisiak for review.
* Refs #34118 -- Adopted asgiref coroutine detection shims.Carlton Gibson2022-12-202-9/+8
| | | Thanks to Mariusz Felisiak for review.
* Updated documentation and comments for RFC updates.Nick Pope2022-11-101-1/+1
| | | | | | | | | | | | | | | - Updated references to RFC 1123 to RFC 5322 - Only partial as RFC 5322 sort of sub-references RFC 1123. - Updated references to RFC 2388 to RFC 7578 - Except RFC 2388 Section 5.3 which has no equivalent. - Updated references to RFC 2396 to RFC 3986 - Updated references to RFC 2616 to RFC 9110 - Updated references to RFC 3066 to RFC 5646 - Updated references to RFC 7230 to RFC 9112 - Updated references to RFC 7231 to RFC 9110 - Updated references to RFC 7232 to RFC 9110 - Updated references to RFC 7234 to RFC 9111 - Tidied up style of text when referring to RFC documents
* Fixed #29186 -- Fixed pickling HttpRequest and subclasses.Anvesh Mishra2022-09-141-0/+10
|
* Fixed #33755 -- Moved ASGI body-file cleanup into request class.Jonas Lundberg2022-06-092-14/+19
|
* Fixed #33754 -- Fixed crash with prematurely closed ASGI request body.Jonas Lundberg2022-05-311-6/+6
| | | | Regression in 441103a04d1d167dc870eaaf90e3fba974f67c93.
* Refs #33173, Refs #30451 -- Fixed ResourceWarning from unclosed body files ↵Mariusz Felisiak2022-05-101-6/+10
| | | | in ASGI handler on Python 3.11+.
* Prevented initialization of unused database connections.Florian Apolloner2022-03-171-6/+3
|
* Fixed #33495 -- Improved debug logging message about adapting handlers for ↵Aaron Chong2022-02-091-2/+2
| | | | | | middlewares. It's the wrapped handler that's adapted to the wrapping middleware.
* Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak2022-02-071-1/+2
|
* Refs #33476 -- Reformatted code with Black.django-bot2022-02-074-171/+252
|
* Removed unused buf_size argument to LimitedStream().Nick Pope2022-01-181-2/+1
| | | Unused since its introduction in 269e921756371bee6d35a967bc2ffe84d1ae39eb.
* Changed django.utils.log.log_response() to take exception instance.Adam Johnson2022-01-121-4/+4
| | | | | | There's little point retrieving a fresh reference to the exception in the legacy tuple format, when it's all available via the exception instance we already have.
* Added exception to SuspiciousOperation logging.Adam Johnson2022-01-121-0/+1
| | | This allows better debugging and filtering of errors.
* Refs #32956 -- Changed docs to treat the acronym HTTP phonetically.David Smith2021-10-181-1/+1
|
* Fixed 32956 -- Lowercased spelling of "web" and "web framework" where ↵David Smith2021-07-291-1/+1
| | | | appropriate.
* Fixed #32889 -- Allowed per-request sync_to_async context in ASGIHandler .Allan Feldman2021-07-011-1/+9
| | | | | | | | | | | | | By using a asgiref's ThreadSensitiveContext context manager, requests will be able to execute independently of other requests when sync work is involved. Prior to this commit, a single global thread was used to execute any sync work independent of the request from which that work was scheduled. This could result in contention for the global sync thread in the case of a slow sync function. Requests are now isolated to their own sync thread.
* Removed unreachable SystemExit check.Adam Johnson2021-01-191-4/+0
| | | | | | | | | This check dates back to Python <2.5, before Python introduced BaseException to prevent exactly unwarranted catching of SystemExit (and others). response_for_exception() is only called under `except Exception` or `except Http404` so it's now impossible for a SystemExit instance to reach the branch.
* Fixed #32299 -- Prevented mutating handlers when processing middlewares ↵Mariusz Felisiak2020-12-291-2/+4
| | | | | marking as unused in an async context. Thanks Hubert Bielenia for the report.
* Fixed #32128 -- Added asgiref 3.3 compatibility.Carlton Gibson2020-10-272-2/+2
| | | | | Thread sensitive parameter is True by default from asgiref v3.3.0. Added an explicit thread_sensitive=False to previously implicit uses.
* Fixed #31962 -- Made SessionMiddleware raise SessionInterrupted when session ↵Hasan Ramezani2020-09-091-1/+12
| | | | destroyed while request is processing.
* Removed unused param_dict return from URLResolver.resolve_error_handler().Adam Johnson2020-06-221-4/+4
| | | Unused since its introduction in ed114e15106192b22ebb78ef5bf5bce72b419d13.
* Refs #31040, Refs #31224 -- Prevented cycles in exceptions chain.Mariusz Felisiak2020-05-281-2/+10
| | | | | | | Async exception handling was raising an exception that was creating a cycle in the exception chain (by re-raising an exception in sync_to_async that was already being handled). Thanks Chris Jerdonek for detailed analysis.
* Updated logging calls to use arguments instead of string interpolation.François Freitag2020-05-131-1/+1
|
* Fixed #31515 -- Made ASGIHandler dispatch lifecycle signals with thread ↵Carlton Gibson2020-05-061-2/+2
| | | | sensitive.
* Fixed #31224 -- Added support for asynchronous views and middleware.Andrew Godwin2020-03-183-52/+226
| | | | | This implements support for asynchronous views, asynchronous tests, asynchronous middleware, and an asynchronous test client.
* Refs #31224 -- Added BaseHandler.check_response().Andrew Godwin2020-02-191-17/+25
|
* Fixed #31240 -- Properly closed FileResponse when wsgi.file_wrapper is used.Florian Apolloner2020-02-112-1/+5
| | | | Thanks to Oskar Persson for the report.
* Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani2019-10-291-2/+2
|
* Refs #23919 -- Replaced super(ASGIHandler, self) with super().Jon Dufresne2019-08-261-1/+1
|
* Refs #30669 -- Removed incorrect branch in ASGIHander.read_body().Carlton Gibson2019-07-311-7/+2
| | | | None is not valid for settings.FILE_UPLOAD_MAX_MEMORY_SIZE. Always use SpooledTemporaryFile.
* Fixed #30567 -- Made WSGIHandler pass FileResponse.block_size to ↵Piotr Domanski2019-07-261-1/+1
| | | | wsgi.file_wrapper.
* Refs #30451 -- Added more tests for ASGIRequest and ASGIHandler.Mariusz Felisiak2019-06-201-1/+1
|
* Fixed #30451 -- Added ASGI handler and coroutine-safety.Andrew Godwin2019-06-201-0/+297
| | | | | This adds an ASGI handler, asgi.py file for the default project layout, a few async utilities and adds async-safety to many parts of Django.
* Refs #30451 -- Added HttpRequest._set_content_type_params() hook.Mariusz Felisiak2019-06-151-10/+2
|
* Refs #24829 -- Removed TemplateResponse rendering in BaseHandler.get_response().Tim Graham2018-11-201-9/+0
| | | | Obsolete since 742ea51413b3aab07c6afbfd1d52c1908ffcb510.
* Corrected docs and removed unused code for got_request_exception signal's ↵Tim Graham2018-11-201-2/+2
| | | | | | sender argument. Inaccurate since 7d1b69dbe7f72ac04d2513f0468fe2146231b286.
* Removed BaseHandler.get_exception_response().Tim Graham2018-11-201-4/+1
| | | | Unused since 7d1b69dbe7f72ac04d2513f0468fe2146231b286.
* Refs #28909 -- Simplifed code using unpacking generalizations.Sergey Fedoseev2018-09-281-3/+4
|
* Fixed #29673 -- Reset the URLconf at the end of each request.Matthew Power2018-09-261-0/+9
| | | Co-authored-by: Ross Thorne <rmwthorne@googlemail.com>
* Refs #29784 -- Switched to https:// links where available.Jon Dufresne2018-09-261-1/+1
|