There are a lot of domain names out there that start/end with a
non-alphanumerical character which is why we need to remove this check.
We also need to accept underscores in domain names.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
for label in labels:
if not 1 <= len(label) <= 63:
return False
- if not label[0].isalnum() or not label[-1].isalnum():
- return False
for ch in label:
- if not (ch.isalnum() or ch == "-"):
+ if not ch.isalnum() or ch in "-_":
return False
return True