-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Multipart read_chunk without content-length #750
Conversation
|
||
@asyncio.coroutine | ||
def _read_chunk_from_stream(self, size): | ||
""" Reads content chunk of body part with unknown length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to start docstring from space.
Surprise to read about Chrome, but it's good to have |
@kxepal if no more comments, let's consider PR as ready-to-merge. |
Yes, looks good to me. |
7dda8eb
to
8c7950f
Compare
pep8 fixes for PR fixes for PR fix typo don't search boundary twice
8c7950f
to
f1351a3
Compare
@kxepal squashed and rebased. |
Multipart read_chunk without content-length
@tumb1er thanks! |
Allows to read body parts of multipart/form-data request without Content-Length header for parts.
Current
BodyPartReader.read_chunk
requires Content-Length header to be set in body part. In fact, simple html form with file field doesn't send file length (at least in Chrome), so read_chunk is unusable for large binary file uploads.Proposed implementation does two things:
aiohttp.streams.StreamReader
viaunread_data
method.Since next body part content may occure in last read chunk,
BodyPartReader._unread
deque is not enough, and data should be returned toStreamReader
instance.