Skip to content

Commit

Permalink
fix #1526: multipart messages should consume their epilogue (#1532)
Browse files Browse the repository at this point in the history
Currently a multipart message epilogue is left unread which when nested
in another multipart message causes a ValueError to be raised because
the parent reader expects to find its multipart boundary not the
sub-message's epilogue.

fixes issue #1526
  • Loading branch information
terencehonles authored and Nikolay Kim committed Feb 1, 2017
1 parent 7107386 commit 9879a88
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions aiohttp/multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ def _read_boundary(self):
pass
elif chunk == self._boundary + b'--':
self._at_eof = True
yield from self._readline()
else:
raise ValueError('Invalid boundary %r, expected %r'
% (chunk, self._boundary))
Expand Down
1 change: 1 addition & 0 deletions tests/test_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ def test_release(self):
b'\r\n'
b'passed\r\n'
b'----:----\r\n'
b'\r\n'
b'--:--'))
yield from reader.release()
self.assertTrue(reader.at_eof())
Expand Down
1 change: 1 addition & 0 deletions tests/test_py35/test_multipart_35.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async def test_async_for_reader(loop):
b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03K\xcc\xcc\xcf())'
b'\xe0\x02\x00\xd6\x90\xe2O\x08\x00\x00\x00',
b'--::--',
b'',
b'--:--',
b''])))
idata = iter(data)
Expand Down

0 comments on commit 9879a88

Please sign in to comment.