From 1a977f0f62373cc53ef248f9ba901bbe43a01eb6 Mon Sep 17 00:00:00 2001 From: ClosedPort22 <44864697+ClosedPort22@users.noreply.github.com> Date: Thu, 23 Mar 2023 19:57:13 +0800 Subject: [PATCH] [downloader:http] handle exceptions in 'validate' This isn't strictly necessary for 'exhentai.py', but it improves efficiency when the adapter is reused --- gallery_dl/downloader/http.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 59cd0ac0..b3f381ec 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -182,7 +182,11 @@ class HttpDownloader(DownloaderBase): # check for invalid responses validate = kwdict.get("_http_validate") if validate and self.validate: - result = validate(response) + try: + result = validate(response) + except Exception: + self.release_conn(response) + raise if isinstance(result, str): url = result tries -= 1