mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #16301: Fix the localhost verification in urllib/request.py for file://. Modify tests to use localhost for local temp files, which could make Windows Buildbot (#16300) happy
This commit is contained in:
parent
efb15993f8
commit
40d8078f41
3 changed files with 5 additions and 2 deletions
|
@ -277,7 +277,7 @@ Content-Type: text/html; charset=iso-8859-1
|
||||||
|
|
||||||
def test_file_notexists(self):
|
def test_file_notexists(self):
|
||||||
fd, tmp_file = tempfile.mkstemp()
|
fd, tmp_file = tempfile.mkstemp()
|
||||||
tmp_fileurl = 'file://' + tmp_file
|
tmp_fileurl = 'file://localhost' + tmp_file
|
||||||
|
|
||||||
self.assertTrue(os.path.exists(tmp_file))
|
self.assertTrue(os.path.exists(tmp_file))
|
||||||
self.assertTrue(urlopen(tmp_fileurl))
|
self.assertTrue(urlopen(tmp_fileurl))
|
||||||
|
|
|
@ -1905,7 +1905,7 @@ class URLopener:
|
||||||
return addinfourl(open(localname, 'rb'), headers, urlfile)
|
return addinfourl(open(localname, 'rb'), headers, urlfile)
|
||||||
host, port = splitport(host)
|
host, port = splitport(host)
|
||||||
if (not port
|
if (not port
|
||||||
and socket.gethostbyname(host) in (localhost() + thishost())):
|
and socket.gethostbyname(host) in ((localhost(),) + thishost())):
|
||||||
urlfile = file
|
urlfile = file
|
||||||
if file[:1] == '/':
|
if file[:1] == '/':
|
||||||
urlfile = 'file://' + file
|
urlfile = 'file://' + file
|
||||||
|
|
|
@ -59,6 +59,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #16301: Fix the localhost verification in urllib/request.py for file://
|
||||||
|
urls.
|
||||||
|
|
||||||
- Issue #16250: Fix the invocations of URLError which had misplaced filename
|
- Issue #16250: Fix the invocations of URLError which had misplaced filename
|
||||||
attribute for exception.
|
attribute for exception.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue