mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Closes issue11563 test_urllibnet is triggering a ResourceWarning. Patch by Jeff McNeil.
This commit is contained in:
commit
a4d5b0cb62
2 changed files with 12 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue