[dl:http] implement '_http_segmented' (#8602)

This commit is contained in:
Mike Fährmann
2025-11-30 19:23:10 +01:00
parent 5f38d8ab25
commit cff04f1181
2 changed files with 14 additions and 4 deletions

View File

@@ -342,9 +342,15 @@ class HttpDownloader(DownloaderBase):
raise
# check file size
if size and fp.tell() < size:
msg = f"file size mismatch ({fp.tell()} < {size})"
output.stderr_write("\n")
if size and (fsize := fp.tell()) < size:
if (segmented := kwdict.get("_http_segmented")) and \
segmented is True or segmented == fsize:
tries -= 1
msg = "Resuming segmented download"
output.stdout_write("\r")
else:
msg = f"file size mismatch ({fsize} < {size})"
output.stderr_write("\n")
continue
break