1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

bugfix: ChunkedDataReader handles zero-length chunk properly, add test

This commit is contained in:
Ilya Kreymer 2014-04-23 10:00:25 -07:00
parent 48e8e8eb1c
commit cd017669ae
2 changed files with 5 additions and 1 deletions

View File

@ -221,7 +221,7 @@ class ChunkedDataReader(DecompressingBufferedReader):
if not chunk_size:
# chunk_size 0 indicates end of file
self.all_chunks_read = True
#self._process_read('')
self._process_read('')
return
data_len = len(self._data)

View File

@ -83,6 +83,10 @@ Chunked data cut off part way through:
>>> c.read() + c.read()
'123412'
Zero-Length chunk:
>>> ChunkedDataReader(BytesIO("0\r\n\r\n")).read()
''
Chunked data cut off with exceptions
>>> c = ChunkedDataReader(BytesIO("4\r\n1234\r\n4\r\n12"), raise_exceptions=True)
>>> c.read() + c.read()