mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Backporing the fix from Issue #12692
This commit is contained in:
parent
3e86ba4e32
commit
b6fac245b5
3 changed files with 10 additions and 0 deletions
|
@ -1251,6 +1251,12 @@ class AbstractHTTPHandler(BaseHandler):
|
|||
raise URLError(err)
|
||||
else:
|
||||
r = h.getresponse()
|
||||
# If the server does not send us a 'Connection: close' header,
|
||||
# HTTPConnection assumes the socket should be left open. Manually
|
||||
# mark the socket to be closed when this response object goes away.
|
||||
if h.sock:
|
||||
h.sock.close()
|
||||
h.sock = None
|
||||
|
||||
r.url = req.get_full_url()
|
||||
# This line replaces the .msg attribute of the HTTPResponse
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue