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 |
| if self._at_eof: | ||
| return b'' | ||
| data = bytearray() | ||
| if self._length is None: |
tests/test_multipart.py
Outdated
|
|
||
| def test_reading_long_part(self): | ||
| # should stay larger than aiohttp.streams.DEFAULT_LIMIT | ||
| size = 2 ** 18 |
There was a problem hiding this comment.
Can this value be picked from aiohttp.streams.DEFAULT_LIMIT to be in sync?
There was a problem hiding this comment.
sure, i've updated the commit
| 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.
Well, actually test reads the boundary (: In previous case it just was placed into unread buffer.
There was a problem hiding this comment.
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
StreamReaderclass only accepts lines up to 64KB.I've updated the
MultipartReaderclass to avoidreadlinewhen it doesn't really make sense, and to useread_chunkinstead.As far as I can see, it seems to work, but that might not be the right approach to solve this at all…