Scrapy, a fast high-level web crawling & scraping framework for Python.
Added content-type check as per issue #193
Ruben Vereecken92780b70da60
diff --git a/scrapy/contrib/downloadermiddleware/httpcompression.py b/scrapy/contrib/downloadermiddleware/httpcompression.pyindex b03a29d67..719507396 100644--- a/scrapy/contrib/downloadermiddleware/httpcompression.py+++ b/scrapy/contrib/downloadermiddleware/httpcompression.py@@ -1,6 +1,6 @@import zlib-from scrapy.utils.gz import gunzip+from scrapy.utils.gz import gunzip, is_gzippedfrom scrapy.http import Response, TextResponsefrom scrapy.responsetypes import responsetypesfrom scrapy.exceptions import NotConfigured@@ -22,7 +22,7 @@ class HttpCompressionMiddleware(object):def process_response(self, request, response, spider):if isinstance(response, Response):content_encoding = response.headers.getlist('Content-Encoding')- if content_encoding:+ if content_encoding and not is_gzipped(response):encoding = content_encoding.pop()decoded_body = self._decode(response.body, encoding.lower())respcls = responsetypes.from_args(headers=response.headers, \