Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b6fac245
Commit
b6fac245
authored
Dec 28, 2013
by
Senthil Kumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backporing the fix from Issue #12692
parent
3e86ba4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
Lib/test/test_urllib2.py
Lib/test/test_urllib2.py
+1
-0
Lib/urllib/request.py
Lib/urllib/request.py
+6
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_urllib2.py
View file @
b6fac245
...
...
@@ -283,6 +283,7 @@ class MockHTTPClass:
self
.
req_headers
=
[]
self
.
data
=
None
self
.
raise_on_endheaders
=
False
self
.
sock
=
None
self
.
_tunnel_headers
=
{}
def
__call__
(
self
,
host
,
timeout
=
socket
.
_GLOBAL_DEFAULT_TIMEOUT
):
...
...
Lib/urllib/request.py
View file @
b6fac245
...
...
@@ -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
...
...
Misc/NEWS
View file @
b6fac245
...
...
@@ -29,6 +29,9 @@ Core and Builtins
Library
-------
- Issue #12692: Backport the fix for ResourceWarning in test_urllib2net. This
also helps in closing the socket when Connection Close header is not sent.
- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl
module, rather than silently let them emit clear text data.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment