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

This commit is contained in:
Pablo Hoffman 2012-02-11 20:28:09 -02:00
parent acf69dac44
commit 900bf08fb6
1 changed files with 3 additions and 1 deletions

View File

@ -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