Author christian.heimes
Recipients Arfrever, christian.heimes, fweimer, iankko, mpessas, pitrou, tim.peters, timehorse
Date 2013-05-16.18:10:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368727843.45.0.423431320341.issue17980@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-05-16 18:10:43christian.heimessetrecipients: + christian.heimes, tim.peters, pitrou, timehorse, Arfrever, iankko, fweimer, mpessas
2013-05-16 18:10:43christian.heimessetmessageid: <1368727843.45.0.423431320341.issue17980@psf.upfronthosting.co.za>
2013-05-16 18:10:43christian.heimeslinkissue17980 messages
2013-05-16 18:10:43christian.heimescreate