Issue #18792: Use "127.0.0.1" or "::1" instead of "localhost" as much as possible, since "localhost" goes through a DNS lookup under recent Windows versions.

This commit is contained in:
Antoine Pitrou 2013-08-22 00:39:46 +02:00
parent 13423c3726
commit f6fbf56071
6 changed files with 24 additions and 14 deletions

View file

@ -480,7 +480,11 @@ def requires_mac_ver(*min_version):
return decorator
HOST = 'localhost'
# Don't use "localhost", since resolving it uses the DNS under recent
# Windows versions (see issue #18792).
HOST = "127.0.0.1"
HOSTv6 = "::1"
def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
"""Returns an unused port that should be suitable for binding. This is