Skip to content

Instantly share code, notes, and snippets.

@slingamn
Created September 10, 2012 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slingamn/32f5030728b9d241d128 to your computer and use it in GitHub Desktop.
Save slingamn/32f5030728b9d241d128 to your computer and use it in GitHub Desktop.
diff --git a/requests/packages/urllib3/connectionpool.py b/requests/packages/urllib3/connectionpool.py
index 26f0176..31416d6 100644
--- a/requests/packages/urllib3/connectionpool.py
+++ b/requests/packages/urllib3/connectionpool.py
@@ -302,6 +302,8 @@ class HTTPConnectionPool(ConnectionPool, RequestMethods):
while True:
conn = old_pool.get(block=False)
if conn:
+ if conn.sock:
+ conn.sock.shutdown(socket.SHUT_RDWR)
conn.close()
except Empty:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment