Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
bd26b546
Commit
bd26b546
authored
12 years ago
by
Nadeem Vawda
Browse files
Options
Download
Email Patches
Plain Diff
Issue #12692: Fix resource leak in urllib.request.
parent
ca4a5251
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 @
bd26b546
...
...
@@ -302,6 +302,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
):
...
...
This diff is collapsed.
Click to expand it.
Lib/urllib/request.py
View file @
bd26b546
...
...
@@ -1255,6 +1255,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
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS
View file @
bd26b546
...
...
@@ -59,6 +59,9 @@ Core and Builtins
Library
-------
-
Issue
#
12692
:
Fix
resource
leak
in
urllib
.
request
when
talking
to
an
HTTP
server
that
does
not
include
a
"Connection: close"
header
in
its
responses
.
-
Issue
#
12034
:
Fix
bogus
caching
of
result
in
check_GetFinalPathNameByHandle
.
Patch
by
Atsuo
Ishimoto
.
...
...
This diff is collapsed.
Click to expand it.
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