forked from extern/httpie-cli
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.
|
# Disable content encoding so that we can resume, etc.
|
||||||
request_headers['Accept-Encoding'] = None
|
request_headers['Accept-Encoding'] = None
|
||||||
if self._resume:
|
if self._resume:
|
||||||
try:
|
|
||||||
bytes_have = os.path.getsize(self._output_file.name)
|
bytes_have = os.path.getsize(self._output_file.name)
|
||||||
except OSError as e:
|
if bytes_have:
|
||||||
if e.errno != errno.ENOENT:
|
|
||||||
raise
|
|
||||||
else:
|
|
||||||
# Set ``Range`` header to resume the download
|
# Set ``Range`` header to resume the download
|
||||||
# TODO: Use "If-Range: mtime" to make sure it's fresh?
|
# TODO: Use "If-Range: mtime" to make sure it's fresh?
|
||||||
request_headers['Range'] = 'bytes=%d-' % bytes_have
|
request_headers['Range'] = 'bytes=%d-' % bytes_have
|
||||||
|
Loading…
Reference in New Issue
Block a user