Skip to content

Commit

Permalink
decompress stream if it is gzipped
Browse files Browse the repository at this point in the history
  • Loading branch information
traut committed Oct 31, 2016
1 parent a68ed4d commit 8bb39f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cabby/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys

import furl
import gzip
import requests
from lxml import etree
from six.moves import urllib
Expand Down Expand Up @@ -66,8 +67,8 @@ def send_taxii_request(session, url, request, taxii_binding=None,

stream, headers = response.raw, response.headers

log.info("Response received for {} from {}"
.format(request.message_type, url))
if 'gzip' in headers.get('content-encoding', ''):

This comment has been minimized.

Copy link
@aukjan

aukjan Oct 31, 2016

@traut is GZIP the only thing? or also 'Compress' ?

This comment has been minimized.

Copy link
@traut

traut Oct 31, 2016

Author Contributor

https://en.wikipedia.org/wiki/HTTP_compression#Content-Encoding_tokens

compress is deprecated and replaced with gzip

I think we should add different compressions on a case-by-case basis, one by one

This comment has been minimized.

Copy link
@aukjan

aukjan Oct 31, 2016

ok. great ! thanks ;)

stream = gzip.GzipFile(fileobj=stream)

gen = _parse_response(stream, headers, version=request.version)
obj = next(gen)
Expand Down

0 comments on commit 8bb39f9

Please sign in to comment.