Trap UnicodeError to handle cases where hostnames returned by DNS are invalid.

This commit is contained in:
Chris Lawrence 2020-03-23 19:52:25 -04:00 committed by Brian May
parent f0c13eafe9
commit ee36cc0d00

View File

@ -108,7 +108,7 @@ def _check_revdns(ip):
debug3('< %s\n' % r[0])
check_host(r[0])
found_host(r[0], ip)
except socket.herror:
except (socket.herror, UnicodeError):
pass
@ -119,7 +119,7 @@ def _check_dns(hostname):
debug3('< %s\n' % ip)
check_host(ip)
found_host(hostname, ip)
except socket.gaierror:
except (socket.gaierror, UnicodeError):
pass