#35592 closed New feature (duplicate)
ASGIHandler fully buffers request before handling it
| Reported by: | Klaas van Schelven | Owned by: | |
|---|---|---|---|
| Component: | HTTP handling | Version: | 5.1 |
| Severity: | Normal | Keywords: | asgi |
| Cc: | Carlton Gibson | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The ASGIHandler reads the full request body before proceeding with actually "doing the Django thing" (processing the request with a view).
In this aspect the ASGIHandler has less support for streaming than the WSGIHandler.
When running Django as a WSGI application, I am able to start reading from a request (using request.read(chunk_size) as it becomes available to my web server. This enables me to process large requests in a streaming way (lower latency, support for abort-early). When running Django as an ASGI application (at least as per the provided asgi.py) I am unable to do this.
This is contrary to my general expectation that things starting with an 'A' should have equal or better support for streaming than things starting with a 'W'. The following line from the ASGI spec gives credit to that expectation "ASGI attempts to preserve a simple application interface, while providing an abstraction that allows for data to be sent and received at any time"
Change History (2)
comment:1 by , 16 months ago
| Component: | Uncategorized → HTTP handling |
|---|---|
| Keywords: | asgi added |
| Resolution: | → duplicate |
| Status: | new → closed |
| Type: | Uncategorized → New feature |
comment:2 by , 16 months ago
| Cc: | added |
|---|
Duplicate of #33699. This behaviour is mandated by the ASGI spec. See comment:6 for details.