You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# we ask to read all of the contents, then we know
# we need to verify the content length.
self._verify_content_length()
returnchunk
If anyone asks for 0 bytes from a StreamingBody, the conditional on line 76 will pass because chunk is empty (since 0 bytes were asked for) and amount was set to 0 (not None). This leads to the content length verification, which will fail because you've read 0 bytes so far out of the entire content.
Might be an odd use case, but I feel like is a valid use case.
In fact, I ran into this issue when trying to use the ijson package link.
That library uses .read(0) in order to figure out what type of encoding the stream reader should use. Whether that's the best way to do it or not, I'm not entirely sure. But I feel like .read(0) should still be supported.
If you guys agree that it should be supported, maybe considering a condition like this:
if (not chunk and amt > 0) or amt is None:
The text was updated successfully, but these errors were encountered:
Referring to the read method of
StreamingBody
:botocore/botocore/response.py
Lines 69 to 81 in c632931
If anyone asks for 0 bytes from a StreamingBody, the conditional on line 76 will pass because chunk is empty (since 0 bytes were asked for) and amount was set to 0 (not None). This leads to the content length verification, which will fail because you've read 0 bytes so far out of the entire content.
Might be an odd use case, but I feel like is a valid use case.
In fact, I ran into this issue when trying to use the
ijson
package link.That library uses
.read(0)
in order to figure out what type of encoding the stream reader should use. Whether that's the best way to do it or not, I'm not entirely sure. But I feel like.read(0)
should still be supported.If you guys agree that it should be supported, maybe considering a condition like this:
The text was updated successfully, but these errors were encountered: