Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#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 Carlton Gibson, 2 months ago

Component: UncategorizedHTTP handling
Keywords: asgi added
Resolution: duplicate
Status: newclosed
Type: UncategorizedNew feature

Duplicate of #33699. This behaviour is mandated by the ASGI spec. See comment:6 for details.

comment:2 by Carlton Gibson, 2 months ago

Cc: Carlton Gibson added
Note: See TracTickets for help on using tickets.
Back to Top