mirror of https://github.com/scrapy/scrapy.git
Added content-type check as per issue #193
This commit is contained in:
parent
3df6946256
commit
92780b70da
|
|
@ -1,6 +1,6 @@
|
|||
import zlib
|
||||
|
||||
from scrapy.utils.gz import gunzip
|
||||
from scrapy.utils.gz import gunzip, is_gzipped
|
||||
from scrapy.http import Response, TextResponse
|
||||
from scrapy.responsetypes import responsetypes
|
||||
from 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, \
|
||||
|
|
|
|||
Loading…
Reference in New Issue