summaryrefslogtreecommitdiffstats
path: root/gallery_dl/downloader/http.py
diff options
context:
space:
mode:
Diffstat (limited to 'gallery_dl/downloader/http.py')
-rw-r--r--gallery_dl/downloader/http.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py
index d2efd3f..91ce731 100644
--- a/gallery_dl/downloader/http.py
+++ b/gallery_dl/downloader/http.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright 2014-2021 Mike Fährmann
+# Copyright 2014-2022 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -148,9 +148,15 @@ class HttpDownloader(DownloaderBase):
# check for invalid responses
validate = kwdict.get("_http_validate")
- if validate and not validate(response):
- self.log.warning("Invalid response")
- return False
+ if validate:
+ result = validate(response)
+ if isinstance(result, str):
+ url = result
+ tries -= 1
+ continue
+ if not result:
+ self.log.warning("Invalid response")
+ return False
# set missing filename extension from MIME type
if not pathfmt.extension: