Commit 847f1c77 authored by Matthew Wilkes's avatar Matthew Wilkes

The getaddrinfo API provides a superset of the info provided by gethostbyname...

The getaddrinfo API provides a superset of the info provided by gethostbyname but isn't ipv4 specific.
parent 3872b523
...@@ -35,7 +35,9 @@ class ServerFactory: ...@@ -35,7 +35,9 @@ class ServerFactory:
ip = socket.gethostbyname(defaulthost) ip = socket.gethostbyname(defaulthost)
self._set_default_host(defaulthost, ip) self._set_default_host(defaulthost, ip)
else: else:
self.ip = socket.gethostbyname(self.host) address_info = socket.getaddrinfo(self.host, self.port)
ips = [info[4][0] for info in address_info]
self.ip = ips[0]
self.dnsresolver = dnsresolver self.dnsresolver = dnsresolver
self.module = module self.module = module
self.cgienv = env self.cgienv = env
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment