Skip to content

Commit

Permalink
Do not try to idna convert IPv6 addresses
Browse files Browse the repository at this point in the history
This will fail when the package idna is in use on Python 2. My guess
from a quick skim of the spec is that trying to apply IDNA to IP
adresses is wrong.

See also kjd/idna#58
  • Loading branch information
JanZerebecki committed Sep 27, 2018
1 parent 77bccbe commit d8d35b6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eventlet/support/greendns.py
Expand Up @@ -511,9 +511,9 @@ def getaddrinfo(host, port, family=0, socktype=0, proto=0, flags=0):
flag ensures getaddrinfo(3) does not use the network itself and
allows us to respect all the other arguments like the native OS.
"""
if isinstance(host, six.string_types):
host = host.encode('idna').decode('ascii')
if host is not None and not is_ip_addr(host):
if isinstance(host, six.string_types):
host = host.encode('idna').decode('ascii')
qname, addrs = _getaddrinfo_lookup(host, family, flags)
else:
qname = host
Expand Down

1 comment on commit d8d35b6

@aojea
Copy link

@aojea aojea commented on d8d35b6 Sep 27, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this is not the problem since it's using the python standard library encodings, the problem is related to the idna module

Please sign in to comment.