fix(utils): use getaddrinfo for hostname check to support ipv6 (#21042)

This commit is contained in:
vin01 2022-09-02 01:27:50 +00:00 committed by GitHub
parent 222f1e7ea8
commit 2aa3bb6c00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,7 @@ def is_hostname_valid(host: str) -> bool:
Test if a given hostname can be resolved.
"""
try:
socket.gethostbyname(host)
socket.getaddrinfo(host, None)
return True
except socket.gaierror:
return False