]> granicus.if.org Git - python/commitdiff
Merged revisions 77058 via svnmerge from
authorSenthil Kumaran <orsenthil@gmail.com>
Sun, 27 Dec 2009 09:16:30 +0000 (09:16 +0000)
committerSenthil Kumaran <orsenthil@gmail.com>
Sun, 27 Dec 2009 09:16:30 +0000 (09:16 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77058 | senthil.kumaran | 2009-12-27 14:41:09 +0530 (Sun, 27 Dec 2009) | 4 lines

  Fix for issue5625 - test_urllib2 fails - urlopen error file not on local host.
  This is on hosts with multiple ip addresses.
........

Lib/urllib2.py

index a976533918ade9b801f4c48f0535f661509bd2a2..b7f2cf46e15d36b17d5849f132865e217c8134fd 100644 (file)
@@ -1261,8 +1261,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