Christian Heimes added the comment:
We could use an algorithm that doesn't need regexp for most cases.
pseudo code:
value = value.lower()
hostname = hostname.lower()
if '*' not in value:
return value == hostname
vparts = valuesplit(".")
hparts = hostname.split(".")
if len(vparts) != len(hparts):
# * doesn't match a dot
return False
for v, h in zip(vparts, hparts):
if v == "*":
# match any host part
continue
asterisk = v.count("*")
if asterisk == 0:
if v != h:
return False
elif asterisk == 1:
# match with simple re
else:
# don't support more than one * in a FQDN part
raise TooManyAsterisk
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17980>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com