Skip to content

Commit 1423140

Browse files
committed
fixed struct.error on http compression middleware. closes scrapy#87
1 parent 2fbd662 commit 1423140

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scrapy/utils/gz.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import struct
12
from cStringIO import StringIO
23
from gzip import GzipFile
34

@@ -13,8 +14,9 @@ def gunzip(data):
1314
try:
1415
chunk = f.read(8196)
1516
output += chunk
16-
except IOError:
17+
except (IOError, struct.error):
1718
# complete only if there is some data, otherwise re-raise
19+
# see issue 87 about catching struct.error
1820
if output:
1921
output += f.extrabuf
2022
break

0 commit comments

Comments
 (0)