Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

fixed struct.error on http compression middleware. closes #87

Pablo Hoffman900bf08fb652
diff --git a/scrapy/utils/gz.py b/scrapy/utils/gz.py
index d6221da0d..57bcb2d60 100644
--- a/scrapy/utils/gz.py
+++ b/scrapy/utils/gz.py
@@ -1,3 +1,4 @@
+import struct
from cStringIO import StringIO
from gzip import GzipFile
@@ -13,8 +14,9 @@ def gunzip(data):
try:
chunk = f.read(8196)
output += chunk
- except IOError:
+ except (IOError, struct.error):
# complete only if there is some data, otherwise re-raise
+ # see issue 87 about catching struct.error
if output:
output += f.extrabuf
break