Merge "Accept ipv6 addr with brackets in service parameter"

This commit is contained in:
Zuul 2019-08-01 15:45:24 +00:00 committed by Gerrit Code Review
commit 2590576a9d

View File

@ -1853,15 +1853,11 @@ def is_valid_domain_or_ip(url_str):
# check ipv4 or ipv4 with port # check ipv4 or ipv4 with port
return is_valid_ipv4(ip_with_port[0]) return is_valid_ipv4(ip_with_port[0])
else: else:
# check ipv6 with port # check ipv6
if '[' in url_str: if '[' in url_str:
try: try:
bkt_idx = url_str.index(']') bkt_idx = url_str.index(']')
if bkt_idx + 1 == len(url_str): return is_valid_ipv6(url_str[1:bkt_idx])
# brackets without port
return False
else:
return is_valid_ipv6(url_str[1:bkt_idx])
except Exception: except Exception:
return False return False
else: else: