summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2011-03-19 09:25:27 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2011-03-19 09:25:27 (GMT)
commitd91ffcafcb39a5426e73ce9ec4b15077662ec571 (patch)
tree9cb602f782d889c2e5076870579fc0707d56c2b2 /Lib/urllib
parente147484666bae5ce0d9972ba898c406c80d3ccd8 (diff)
downloadcpython-d91ffcafcb39a5426e73ce9ec4b15077662ec571.zip
cpython-d91ffcafcb39a5426e73ce9ec4b15077662ec571.tar.gz
cpython-d91ffcafcb39a5426e73ce9ec4b15077662ec571.tar.bz2
Closes issue11563 - test_urllibnet ResourceWarning. Patch by Jeff McNeil.
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/request.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 1e437b5..4d3648d 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1657,6 +1657,12 @@ class URLopener:
headers["Authorization"] = "Basic %s" % auth
if realhost:
headers["Host"] = realhost
+
+ # Add Connection:close as we don't support persistent connections yet.
+ # This helps in closing the socket and avoiding ResourceWarning
+
+ headers["Connection"] = "close"
+
for header, value in self.addheaders:
headers[header] = value