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
838ba4ac
Commit
838ba4ac
authored
Oct 21, 2012
by
Nadeem Vawda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12692: Fix resource leak in urllib.request.
parent
348a4887
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 @
838ba4ac
...
...
@@ -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
):
...
...
Lib/urllib/request.py
View file @
838ba4ac
...
...
@@ -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
...
...
Misc/NEWS
View file @
838ba4ac
...
...
@@ -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
.
...
...
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