Skip to content

Commit

Permalink
Add Accept-Encoding: identity for --download
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbrzt committed Mar 7, 2016
1 parent 7ce6eb1 commit 25d1e8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions httpie/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def pre_request(self, request_headers):
:type request_headers: dict
"""
# Disable content encoding so that we can resume, etc.
request_headers['Accept-Encoding'] = None
# Ask the server not to encode the content so that we can resume, etc.
request_headers['Accept-Encoding'] = 'identity'
if self._resume:
bytes_have = os.path.getsize(self._output_file.name)
if bytes_have:
Expand All @@ -201,6 +201,8 @@ def start(self, response):
"""
assert not self.status.time_started

# FIXME: some servers still might sent Content-Encoding: gzip
# <https://github.com/jkbrzt/httpie/issues/423>
try:
total_size = int(response.headers['Content-Length'])
except (KeyError, ValueError, TypeError):
Expand Down Expand Up @@ -299,8 +301,7 @@ def __init__(self):

def started(self, resumed_from=0, total_size=None):
assert self.time_started is None
if total_size is not None:
self.total_size = total_size
self.total_size = total_size
self.downloaded = self.resumed_from = resumed_from
self.time_started = time()

Expand Down
1 change: 1 addition & 0 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
CLIENT_KEY = os.path.join(TESTS_ROOT, 'client_certs', 'client.key')
CLIENT_PEM = os.path.join(TESTS_ROOT, 'client_certs', 'client.pem')

# FIXME:
# We test against a local httpbin instance which uses a self-signed cert.
# Requests without --verify=<CA_BUNDLE> will fail with a verification error.
# See: https://github.com/kevin1024/pytest-httpbin#https-support
Expand Down

0 comments on commit 25d1e8e

Please sign in to comment.