mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 17:23:25 +01:00
parent
7ce6eb148e
commit
25d1e8e418
@ -178,8 +178,8 @@ class Downloader(object):
|
|||||||
:type request_headers: dict
|
:type request_headers: dict
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Disable content encoding so that we can resume, etc.
|
# Ask the server not to encode the content so that we can resume, etc.
|
||||||
request_headers['Accept-Encoding'] = None
|
request_headers['Accept-Encoding'] = 'identity'
|
||||||
if self._resume:
|
if self._resume:
|
||||||
bytes_have = os.path.getsize(self._output_file.name)
|
bytes_have = os.path.getsize(self._output_file.name)
|
||||||
if bytes_have:
|
if bytes_have:
|
||||||
@ -201,6 +201,8 @@ class Downloader(object):
|
|||||||
"""
|
"""
|
||||||
assert not self.status.time_started
|
assert not self.status.time_started
|
||||||
|
|
||||||
|
# FIXME: some servers still might sent Content-Encoding: gzip
|
||||||
|
# <https://github.com/jkbrzt/httpie/issues/423>
|
||||||
try:
|
try:
|
||||||
total_size = int(response.headers['Content-Length'])
|
total_size = int(response.headers['Content-Length'])
|
||||||
except (KeyError, ValueError, TypeError):
|
except (KeyError, ValueError, TypeError):
|
||||||
@ -299,7 +301,6 @@ class Status(object):
|
|||||||
|
|
||||||
def started(self, resumed_from=0, total_size=None):
|
def started(self, resumed_from=0, total_size=None):
|
||||||
assert self.time_started is 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.downloaded = self.resumed_from = resumed_from
|
||||||
self.time_started = time()
|
self.time_started = time()
|
||||||
|
@ -13,6 +13,7 @@ CLIENT_CERT = os.path.join(TESTS_ROOT, 'client_certs', 'client.crt')
|
|||||||
CLIENT_KEY = os.path.join(TESTS_ROOT, 'client_certs', 'client.key')
|
CLIENT_KEY = os.path.join(TESTS_ROOT, 'client_certs', 'client.key')
|
||||||
CLIENT_PEM = os.path.join(TESTS_ROOT, 'client_certs', 'client.pem')
|
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.
|
# We test against a local httpbin instance which uses a self-signed cert.
|
||||||
# Requests without --verify=<CA_BUNDLE> will fail with a verification error.
|
# Requests without --verify=<CA_BUNDLE> will fail with a verification error.
|
||||||
# See: https://github.com/kevin1024/pytest-httpbin#https-support
|
# See: https://github.com/kevin1024/pytest-httpbin#https-support
|
||||||
|
Loading…
Reference in New Issue
Block a user