summaryrefslogtreecommitdiffstats
path: root/gallery_dl/downloader/http.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-10-03 18:31:58 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-10-03 18:31:58 -0400
commitb8758ecd073910ce3220b2e68399147b425c37b8 (patch)
treed6aee20213508c8f425cbacb3d714367eca904c5 /gallery_dl/downloader/http.py
parente2f67519f8c1750a71aab3dc56b8345fff21bac5 (diff)
New upstream version 1.26.0.upstream/1.26.0
Diffstat (limited to 'gallery_dl/downloader/http.py')
-rw-r--r--gallery_dl/downloader/http.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py
index 4ec0398..30ac001 100644
--- a/gallery_dl/downloader/http.py
+++ b/gallery_dl/downloader/http.py
@@ -225,6 +225,14 @@ class HttpDownloader(DownloaderBase):
pathfmt.build_path()
if pathfmt.exists():
pathfmt.temppath = ""
+ # release the connection back to pool by explicitly
+ # calling .close()
+ # see https://requests.readthedocs.io/en/latest/user
+ # /advanced/#body-content-workflow
+ # when the image size is on the order of megabytes,
+ # re-establishing a TLS connection will typically be faster
+ # than consuming the whole response
+ response.close()
return True
if self.part and metadata:
pathfmt.part_enable(self.partdir)
@@ -246,6 +254,7 @@ class HttpDownloader(DownloaderBase):
if self._adjust_extension(pathfmt, file_header) and \
pathfmt.exists():
pathfmt.temppath = ""
+ response.close()
return True
# set open mode