From c69e3eed312404e469dae250592ea6c5b20ebc64 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sat, 30 Jul 2016 07:16:18 -0500 Subject: [PATCH] Close and then release the connection urllib3 closes the underlying connection when we call urllib3.Response.close but does not release it back to the connection pool. This can cause issues when users have a blocking connection pool configured and connections are not readily returned to the pool. Since the underlying connection is closed, we should be able to safely return the connection to the connection pool, so to fix this issue we merely need to not return after closing the response. Closes gh-3461 --- requests/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index ba70e3a6..11434ef4 100644 --- a/requests/models.py +++ b/requests/models.py @@ -868,6 +868,6 @@ class Response(object): *Note: Should not normally need to be called explicitly.* """ if not self._content_consumed: - return self.raw.close() + self.raw.close() return self.raw.release_conn()