diff options
author | Senthil Kumaran <orsenthil@gmail.com> | 2011-03-19 09:47:26 (GMT) |
---|---|---|
committer | Senthil Kumaran <orsenthil@gmail.com> | 2011-03-19 09:47:26 (GMT) |
commit | a4d5b0cb620d8dfc07623f4fe2b551257217589d (patch) | |
tree | 3ed334961542acadc356a96f16942d92204aefd8 /Lib/urllib | |
parent | f95b4df6d2a73b0e3d6c57215c677c6dd9d95410 (diff) | |
parent | d24c991f11541ccdb3cddade4a59ae0d2c0908bd (diff) | |
download | cpython-a4d5b0cb620d8dfc07623f4fe2b551257217589d.zip cpython-a4d5b0cb620d8dfc07623f4fe2b551257217589d.tar.gz cpython-a4d5b0cb620d8dfc07623f4fe2b551257217589d.tar.bz2 |
Closes issue11563 test_urllibnet is triggering a ResourceWarning. Patch by Jeff McNeil.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 96eeb78..a501e37 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 |