[downloader.http] implement file-specific HTTP headers

This commit is contained in:
Mike Fährmann
2019-11-19 23:50:54 +01:00
parent 977026c5ad
commit bbbeff4c41
2 changed files with 9 additions and 5 deletions

View File

@@ -77,12 +77,15 @@ class HttpDownloader(DownloaderBase):
time.sleep(min(2 ** (tries-1), 1800))
tries += 1
headers = {}
# check for .part file
filesize = pathfmt.part_size()
if filesize:
headers = {"Range": "bytes={}-".format(filesize)}
else:
headers = None
headers["Range"] = "bytes={}-".format(filesize)
# file-specific headers
extra = pathfmt.kwdict.get("_http_headers")
if extra:
headers.update(extra)
# connect to (remote) source
try: