diff --git a/docs/configuration.rst b/docs/configuration.rst index c88f8eb1..a64322d8 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -3617,7 +3617,7 @@ Description downloader.http.consume-content ---------------------------------- +------------------------------- Type ``bool`` Default diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 30b59714..59cd0ac0 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -296,8 +296,15 @@ class HttpDownloader(DownloaderBase): def release_conn(self, response): """Release connection back to pool by consuming response body""" - for _ in response.iter_content(self.chunk_size): - pass + try: + for _ in response.iter_content(self.chunk_size): + pass + except (RequestException, SSLError, OpenSSLError) as exc: + print() + self.log.debug( + "Unable to consume response body (%s); " + "closing the connection anyway", exc) + response.close() @staticmethod def receive(fp, content, bytes_total, bytes_start):