From 8430f857b504a3e7406dc36e54dc32783569d0dd Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Thu, 20 Oct 2016 11:56:38 +1300 Subject: The final piece: netlib -> mitproxy.net --- netlib/check.py | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 netlib/check.py (limited to 'netlib/check.py') diff --git a/netlib/check.py b/netlib/check.py deleted file mode 100644 index 7b007cb5..00000000 --- a/netlib/check.py +++ /dev/null @@ -1,22 +0,0 @@ -import re - -_label_valid = re.compile(b"(?!-)[A-Z\d-]{1,63}(? bool: - """ - Checks if a hostname is valid. - """ - try: - host.decode("idna") - except ValueError: - return False - if len(host) > 255: - return False - if host and host[-1:] == b".": - host = host[:-1] - return all(_label_valid.match(x) for x in host.split(b".")) - - -def is_valid_port(port): - return 0 <= port <= 65535 -- cgit v1.2.3