From d8d35b6b8c586fc6e873b090a7438f5a10de6190 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Thu, 27 Sep 2018 19:26:31 +0200 Subject: [PATCH] Do not try to idna convert IPv6 addresses 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 https://github.com/kjd/idna/issues/58 --- eventlet/support/greendns.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eventlet/support/greendns.py b/eventlet/support/greendns.py index 13968c2c1a..0fac033702 100644 --- a/eventlet/support/greendns.py +++ b/eventlet/support/greendns.py @@ -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