summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSenthil Kumaran <orsenthil@gmail.com>2009-12-27 09:11:09 (GMT)
committerSenthil Kumaran <orsenthil@gmail.com>2009-12-27 09:11:09 (GMT)
commit13c2ef92f81092a4e46382e52bf586eb6bf512ed (patch)
tree138465a3214a4b06e73c8d0806c1b2743415ccb5 /Lib
parent1ac1c39aca6326ce6bcf531e420753c00d8046ae (diff)
downloadcpython-13c2ef92f81092a4e46382e52bf586eb6bf512ed.zip
cpython-13c2ef92f81092a4e46382e52bf586eb6bf512ed.tar.gz
cpython-13c2ef92f81092a4e46382e52bf586eb6bf512ed.tar.bz2
Fix for issue5625 - test_urllib2 fails - urlopen error file not on local host.
This is on hosts with multiple ip addresses.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib2.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
index 0f59096..87ef9fb 100644
--- a/Lib/urllib2.py
+++ b/Lib/urllib2.py
@@ -1264,8 +1264,9 @@ class FileHandler(BaseHandler):
def get_names(self):
if FileHandler.names is None:
try:
- FileHandler.names = (socket.gethostbyname('localhost'),
- socket.gethostbyname(socket.gethostname()))
+ FileHandler.names = tuple(
+ socket.gethostbyname_ex('localhost')[2] +
+ socket.gethostbyname_ex(socket.gethostname())[2])
except socket.gaierror:
FileHandler.names = (socket.gethostbyname('localhost'),)
return FileHandler.names