-
-
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
do not use readline when reading the content of a part in the multipart reader #1535
Conversation
fb441fa
to
f8bddd9
Compare
@kxepal |
Current coverage is 98.72% (diff: 100%)@@ master #1535 diff @@
==========================================
Files 30 30
Lines 6995 6989 -6
Methods 0 0
Messages 0 0
Branches 1169 1165 -4
==========================================
- Hits 6920 6900 -20
- Misses 37 53 +16
+ Partials 38 36 -2
|
@arthurdarcet @fafhrd91 |
@@ -252,12 +252,8 @@ def read(self, *, decode=False): | |||
if self._at_eof: | |||
return b'' | |||
data = bytearray() | |||
if self._length is None: |
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.
Nice!
@@ -501,6 +499,17 @@ def test_filename(self): | |||
None) | |||
self.assertEqual('foo.html', part.filename) | |||
|
|||
def test_reading_long_part(self): | |||
# should stay larger than aiohttp.streams.DEFAULT_LIMIT | |||
size = 2 ** 18 |
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.
Can this value be picked from aiohttp.streams.DEFAULT_LIMIT to be in sync?
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.
sure, i've updated the commit
@@ -255,14 +256,13 @@ def test_read_chunk_properly_counts_read_bytes(self): | |||
self.assertEqual(b'.' * size, result) | |||
self.assertTrue(obj.at_eof()) | |||
|
|||
def test_read_does_reads_boundary(self): | |||
def test_read_does_not_read_boundary(self): |
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.
Well, actually test reads the boundary (: In previous case it just was placed into unread buffer.
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.
I'm not entirely sure, but i think it reads the boundary then put in back in the stream (with unread_data
) ; so it's as if it wasn't read
14f6fed
to
279c009
Compare
what is status of this ticket? |
279c009
to
03101a0
Compare
@kxepal ? |
@fafhrd91 Sorry, a bit busy times. I have all the tickets you ping me stared in by inbox, will check them in few hours. |
thanks! |
+1 |
multipart uploads to an aiohttp server with a "large" file containing no new line fails with a
ValueError('Line is too long')
:This is because the
StreamReader
class only accepts lines up to 64KB.I've updated the
MultipartReader
class to avoidreadline
when it doesn't really make sense, and to useread_chunk
instead.As far as I can see, it seems to work, but that might not be the right approach to solve this at all…