mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
bugfix: ChunkedDataReader handles zero-length chunk properly, add test
This commit is contained in:
parent
48e8e8eb1c
commit
cd017669ae
@ -221,7 +221,7 @@ class ChunkedDataReader(DecompressingBufferedReader):
|
|||||||
if not chunk_size:
|
if not chunk_size:
|
||||||
# chunk_size 0 indicates end of file
|
# chunk_size 0 indicates end of file
|
||||||
self.all_chunks_read = True
|
self.all_chunks_read = True
|
||||||
#self._process_read('')
|
self._process_read('')
|
||||||
return
|
return
|
||||||
|
|
||||||
data_len = len(self._data)
|
data_len = len(self._data)
|
||||||
|
@ -83,6 +83,10 @@ Chunked data cut off part way through:
|
|||||||
>>> c.read() + c.read()
|
>>> c.read() + c.read()
|
||||||
'123412'
|
'123412'
|
||||||
|
|
||||||
|
Zero-Length chunk:
|
||||||
|
>>> ChunkedDataReader(BytesIO("0\r\n\r\n")).read()
|
||||||
|
''
|
||||||
|
|
||||||
Chunked data cut off with exceptions
|
Chunked data cut off with exceptions
|
||||||
>>> c = ChunkedDataReader(BytesIO("4\r\n1234\r\n4\r\n12"), raise_exceptions=True)
|
>>> c = ChunkedDataReader(BytesIO("4\r\n1234\r\n4\r\n12"), raise_exceptions=True)
|
||||||
>>> c.read() + c.read()
|
>>> c.read() + c.read()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user