ipv6: getaddrinfo would fail with scope index
Discard any '%' delimited suffix. https://github.com/eventlet/eventlet/pull/322
This commit is contained in:

committed by
Sergey Shepelev

parent
23ea43a65f
commit
ac4e28fd1a
@@ -99,6 +99,7 @@ def is_ipv6_addr(host):
|
|||||||
"""Return True if host is a valid IPv6 address"""
|
"""Return True if host is a valid IPv6 address"""
|
||||||
if not isinstance(host, six.string_types):
|
if not isinstance(host, six.string_types):
|
||||||
return False
|
return False
|
||||||
|
host = host.split('%', 1)[0]
|
||||||
try:
|
try:
|
||||||
dns.ipv6.inet_aton(host)
|
dns.ipv6.inet_aton(host)
|
||||||
except dns.exception.SyntaxError:
|
except dns.exception.SyntaxError:
|
||||||
|
@@ -62,3 +62,10 @@ def test_socket_api_family():
|
|||||||
# It was named family_or_realsock
|
# It was named family_or_realsock
|
||||||
# https://github.com/eventlet/eventlet/issues/319
|
# https://github.com/eventlet/eventlet/issues/319
|
||||||
socket.socket(family=socket.AF_INET)
|
socket.socket(family=socket.AF_INET)
|
||||||
|
|
||||||
|
|
||||||
|
def test_getaddrinfo_ipv6_scope():
|
||||||
|
greendns.is_ipv6_addr('::1%2')
|
||||||
|
if not socket.has_ipv6:
|
||||||
|
return
|
||||||
|
socket.getaddrinfo('::1%2', 80, socket.AF_INET6)
|
||||||
|
Reference in New Issue
Block a user