-
-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability for AsgiHandler and AsgiRequest to process the request body in chunks. #1269
Conversation
…est body in chunks.
Hi @carltongibson. Great. Please, feel free to ask anything about implementation. |
Hi @hozblok. Good stuff. Help me understand it... 🙂 So can you tell me why we need the more complex Make sense? Thanks. |
|
So the idea was that if we can just make I agree with your other points. Fancy jumping onto #1251 and co-authoring it with me? I have time scheduled for the sprints at DjangoCon Europe but if you have capacity we could get it finished and a release out before then? The code side is nearly there. (Just needs removing of the |
Of course, I'm ready to participate. Let's finish it together. The scope of work is clear. First I will reread the entire history of the ticket more carefully. 🙂 |
Hi @carltongibson , Just in case, I will duplicate the new PR here: |
Super. Thanks. I’ll have a look tomorrow. Good work! |
#1001
To prevent a situation when the request body is loaded completely into RAM, I suggest adding
io.IOBase
streams support to theAsgiRequest
class.django.http.HttpRequest
supports work with streams so we have to correctly construct the stream and implementread()
method for Django.In case of early termination of loading the request body, in cases of disconnect or errors (for example, exceeding the file size), we must close the stream correctly and allow to send a response if it is necessary.
The error handling mechanisms and the generation of responses are left unchanged. The ability to work with chunks is essential for the file upload which is usually implemented through a POST request with
multipart/from-data
.Thanks in advance for your feedback. I'm interested in making it better.