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:
Senthil Kumaran 2012-10-22 09:43:04 -07:00
parent efb15993f8
commit 40d8078f41
3 changed files with 5 additions and 2 deletions

View file

@ -1905,7 +1905,7 @@ class URLopener:
return addinfourl(open(localname, 'rb'), headers, urlfile)
host, port = splitport(host)
if (not port
and socket.gethostbyname(host) in (localhost() + thishost())):
and socket.gethostbyname(host) in ((localhost(),) + thishost())):
urlfile = file
if file[:1] == '/':
urlfile = 'file://' + file