Commit 5af8c102 authored by Jason Madden's avatar Jason Madden

Fixes for the ares resolver.

parent 57c4a093
......@@ -222,7 +222,7 @@ def getfqdn(name=''):
else:
aliases.insert(0, hostname)
for name in aliases:
if '.' in name:
if b'.' in name:
break
else:
name = hostname
......
......@@ -682,6 +682,8 @@ class WSGIServer(StreamServer):
name = socket.getfqdn(address[0])
except socket.error:
name = str(address[0])
if PY3 and not isinstance(name, str):
name = name.decode('ascii')
self.environ['SERVER_NAME'] = name
self.environ.setdefault('SERVER_PORT', str(address[1]))
else:
......
......@@ -208,6 +208,8 @@ class Resolver(object):
if _ip_address == ip_address:
raise
waiter.clear()
if isinstance(_ip_address, text_type):
_ip_address = _ip_address.encode('ascii')
self.ares.gethostbyaddr(waiter, _ip_address)
return waiter.get()
......
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