summaryrefslogtreecommitdiffstats
path: root/gallery_dl/downloader/http.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-12-20 05:49:04 -0500
commita24ec1647aeac35a63b744ea856011ad6e06be3b (patch)
treeae94416de786aeddd05d99559098f7f16bb103a6 /gallery_dl/downloader/http.py
parent33f8a8a37a9cba738ef25fb99955f0730da9eb48 (diff)
New upstream version 1.31.1.upstream/1.31.1
Diffstat (limited to 'gallery_dl/downloader/http.py')
-rw-r--r--gallery_dl/downloader/http.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py
index 248bf70..703dcca 100644
--- a/gallery_dl/downloader/http.py
+++ b/gallery_dl/downloader/http.py
@@ -95,7 +95,7 @@ class HttpDownloader(DownloaderBase):
except Exception as exc:
if self.downloading:
output.stderr_write("\n")
- self.log.debug("", exc_info=exc)
+ self.log.traceback(exc)
raise
finally:
# remove file from incomplete downloads
@@ -230,6 +230,10 @@ class HttpDownloader(DownloaderBase):
# check file size
size = text.parse_int(size, None)
if size is not None:
+ if not size:
+ self.release_conn(response)
+ self.log.warning("Empty file")
+ return False
if self.minsize and size < self.minsize:
self.release_conn(response)
self.log.warning(
@@ -342,9 +346,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