#33699: Read ASGI request body from asyncio queue on-demand
-------------------------------+------------------------------------
Reporter: Noxx | Owner: noneNote
Type: New feature | Status: closed
Component: HTTP handling | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: ASGI, async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Carlton Gibson):
* status: assigned => closed
* resolution: => wontfix
Comment:
Looking at this again, with an eye to #33738 — which is how we handle
`http.disconnect` event as they come in — it's not clear that we can
actually read the body file on demand (as nice as that might be in
theory).
The [https://asgi.readthedocs.io/en/latest/specs/www.html#request-receive-
event ASGI spec] is quite clear on the required behaviour:
* "...the body message serves ... as a trigger to actually run request
code (as you should not trigger on a connection opening alone)." (Elided
to bring out the force.)
* `more_body` (bool) – Signifies if there is additional content to come
(as part of a Request message). If `True`, the consuming application
should wait until it gets a chunk with this set to `False`. If `False`,
the request is complete and should be processed.
i.e. The application is not permitted to begin processing the request
until a `more_body: False` is received. You can't get that unless you read
the body.
On top of that, ref #33738, if you want to look for an `http.disconnect`,
however you might do that, you need to have got the body events, which
come in on the same queue, out of the way in order to do that. A handler
for a long-lived connection that wanted to check that the client hadn't
disconnected **before** processing an expensive operation on the submitted
body would be stuck.
Short of a PoC, and an unlikely change to the ASGI spec here, I think we
have to close this as wontfix.
--
Ticket URL: <https://code.djangoproject.com/ticket/33699#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701865a93fc84-cf05c013-e63a-4d95-a629-919e8cccf2c6-000000%40eu-central-1.amazonses.com.