mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Fix closes Issue12576 - fix urlopen behavior on sites which do not send (or obsfuscates) Connection: Close header.
This commit is contained in:
parent
5cd3e305e3
commit
1299a8f3b2
3 changed files with 25 additions and 3 deletions
|
@ -1134,11 +1134,14 @@ class AbstractHTTPHandler(BaseHandler):
|
|||
|
||||
try:
|
||||
h.request(req.get_method(), req.selector, req.data, headers)
|
||||
r = h.getresponse() # an HTTPResponse instance
|
||||
except socket.error as err:
|
||||
except socket.error as err: # timeout error
|
||||
raise URLError(err)
|
||||
finally:
|
||||
h.close()
|
||||
try:
|
||||
r = h.getresponse() # an HTTPResponse instance
|
||||
except Exception as exp:
|
||||
h.close()
|
||||
raise exp
|
||||
|
||||
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