Closes issue11563 - test_urllibnet ResourceWarning. Patch by Jeff McNeil.
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 @@
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