allowing for _ in domains
This commit is contained in:
parent
1b8507636b
commit
1bcc9d5d0d
|
@ -35,7 +35,7 @@ def is_valid_domain(domain):
|
|||
domain = domain[:-1]
|
||||
if len(domain) > 253:
|
||||
return False
|
||||
fqdn_re = re.compile("(?=^.{1,63}$)(^(?:[a-z0-9](?:-*[a-z0-9])+)$|^[a-z0-9]$)", re.IGNORECASE)
|
||||
fqdn_re = re.compile("(?=^.{1,63}$)(^(?:[a-z0-9_](?:-*[a-z0-9_])+)$|^[a-z0-9]$)", re.IGNORECASE)
|
||||
return all(fqdn_re.match(d) for d in domain.split("."))
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class TestDNSProvider(unittest.TestCase):
|
|||
self.assertTrue(dnsutil.is_valid_domain('example.io'))
|
||||
self.assertTrue(dnsutil.is_valid_domain('example-of-under-63-character-domain-label-length-limit-1234567.com'))
|
||||
self.assertFalse(dnsutil.is_valid_domain('example-of-over-63-character-domain-label-length-limit-123456789.com'))
|
||||
self.assertFalse(dnsutil.is_valid_domain('_acme-chall.example.com'))
|
||||
self.assertTrue(dnsutil.is_valid_domain('_acme-chall.example.com'))
|
||||
self.assertFalse(dnsutil.is_valid_domain('e/xample.com'))
|
||||
self.assertFalse(dnsutil.is_valid_domain('exam\ple.com'))
|
||||
self.assertFalse(dnsutil.is_valid_domain('<example.com'))
|
||||
|
|
Loading…
Reference in New Issue