#35289: Chunked transfer encoding is not handled correctly by MultiPartParser
-------------------------------------+-------------------------------------
     Reporter:  Kyle Agronick        |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  HTTP handling        |                  Version:  5.0
     Severity:  Normal               |               Resolution:
     Keywords:  transfer-encoding,   |             Triage Stage:
  chunked, multi-part                |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Kyle Agronick):

 Replying to [comment:3 bcail]:
 > [https://github.com/django/daphne/issues/476 This Daphne issue] may be
 relevant. There's a quote in that issue (from the ASGI spec) that the ASGI
 server is supposed to dechunk the request - so shouldn't it come to Django
 as a regular (not chunked) request? Hopefully someone else will weigh in
 here as well.
 >
 > What ASGI server are you using?

 You can see in the ASGI spec mentioned in that ticket it says "a response
 that is given to the server with no Content-Length may be chunked as the
 server sees fit". Which is what is happening. Everything is streaming into
 Django correctly. It just doesn't know how to handle a non-existent
 content length.

 That seems to be the same issue and I would argue this is a Django issue
 as ASGI servers are streaming the results correctly. If the ASGI servers
 were expected to buffer the files you would introduce blocking IO with
 tempfiles or OOM issues if it all happened in memory. I came across this
 issue while trying to implement large file uploads >6GB. The less
 buffering the better.

 I am using Daphene in development and Uvicorn in production. My hacky
 middleware fix with the content-length seems to work on both of them.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35289#comment:4>
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/0107018e518a3c1a-036cf008-c95f-4f18-b0b2-390329bbd3a4-000000%40eu-central-1.amazonses.com.

Reply via email to