bug fix for charset used in inference for pages retrieved with --null-connection

This commit is contained in:
Miroslav Stampar
2011-01-20 11:01:01 +00:00
parent a4a0f10950
commit f6f4b5e9dd
2 changed files with 5 additions and 1 deletions

View File

@@ -122,6 +122,9 @@ def decodePage(page, contentEncoding, contentType):
Decode compressed/charset HTTP response
"""
if not page or (conf.nullConnection and len(page) < 2):
return getUnicode(page)
if isinstance(contentEncoding, basestring) and contentEncoding.lower() in ('gzip', 'x-gzip', 'deflate'):
if contentEncoding == 'deflate':
# http://stackoverflow.com/questions/1089662/python-inflate-and-deflate-implementations