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

chunkeddatareader: read(): catch ValueError when attempting to read again in case stream is already closed

This commit is contained in:
Ilya Kreymer 2015-03-31 23:31:49 -07:00
parent 990af5ee79
commit 8e60a6464c

View File

@ -289,7 +289,12 @@ class ChunkedDataReader(BufferedReader):
# if length specified, attempt to read exact length
rem = length - len(buf)
while rem > 0:
new_buf = super(ChunkedDataReader, self).read(rem)
try:
new_buf = super(ChunkedDataReader, self).read(rem)
except ValueError:
# in case already closed, seems to happen in 2.6, just return
break
if not new_buf:
break