mirror of
https://github.com/httpie/cli.git
synced 2024-11-21 23:33:12 +01:00
Only use Range when already have a partial download.
This commit is contained in:
parent
e8d79c4d8c
commit
d32acfe2fa
@ -170,12 +170,8 @@ class Download(object):
|
||||
# Disable content encoding so that we can resume, etc.
|
||||
request_headers['Accept-Encoding'] = None
|
||||
if self._resume:
|
||||
try:
|
||||
bytes_have = os.path.getsize(self._output_file.name)
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
else:
|
||||
bytes_have = os.path.getsize(self._output_file.name)
|
||||
if bytes_have:
|
||||
# Set ``Range`` header to resume the download
|
||||
# TODO: Use "If-Range: mtime" to make sure it's fresh?
|
||||
request_headers['Range'] = 'bytes=%d-' % bytes_have
|
||||
|
Loading…
Reference in New Issue
Block a user