[downloader:http] reorder HTTP header sources

so that any header can be overwritten by a user, except Range
This commit is contained in:
Mike Fährmann 2021-08-05 22:30:17 +02:00
parent 5d5ab669fa
commit b5b1cf22b7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -98,20 +98,21 @@ class HttpDownloader(DownloaderBase):
time.sleep(tries)
tries += 1
headers = {"Accept": "*/*"}
file_header = None
# check for .part file
file_size = pathfmt.part_size()
if file_size:
headers["Range"] = "bytes={}-".format(file_size)
# general headers
if self.headers:
headers.update(self.headers)
# file-specific headers
# collect HTTP headers
headers = {"Accept": "*/*"}
# file-specific headers
extra = kwdict.get("_http_headers")
if extra:
headers.update(extra)
# general headers
if self.headers:
headers.update(self.headers)
# partial content
file_size = pathfmt.part_size()
if file_size:
headers["Range"] = "bytes={}-".format(file_size)
# connect to (remote) source
try: