aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMarcus R. Matos <marcus@matosconsulting.com>2020-04-03 20:15:50 -0500
committerMarcus R. Matos <marcus@matosconsulting.com>2020-04-03 20:15:50 -0500
commit2722f4fd764657b1f059c66aa75a879acd56abca (patch)
treed54535b9ed8c696d1ce8d6502f02d9f8be6c102f /mitmproxy
parent1039d09ed618afadf5d24a741d85ec34be29edd7 (diff)
downloadmitmproxy-2722f4fd764657b1f059c66aa75a879acd56abca.tar.gz
mitmproxy-2722f4fd764657b1f059c66aa75a879acd56abca.tar.bz2
mitmproxy-2722f4fd764657b1f059c66aa75a879acd56abca.zip
#3885 handle hyphens in domain name, enhance validation checks, linter updates
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/net/check.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mitmproxy/net/check.py b/mitmproxy/net/check.py
index 90600195..32e733af 100644
--- a/mitmproxy/net/check.py
+++ b/mitmproxy/net/check.py
@@ -15,7 +15,9 @@ we'll go with the least restrictive rules while still providing a sanity check.
"""
# label regex: in total between 4 and 255 chars, tld 2 to 63 chars, each label 1 to 63 chars
-_label_valid = re.compile(br"^(?=.{4,255}$)([A-Z0-9_-]([A-Z0-9_-]{0,61}[A-Z0-9_-])?\.){1,126}[A-Z0-9][A-Z0-9-]{0,61}[A-Z0-9]$", re.IGNORECASE)
+_label_valid = re.compile(
+ br"^(?=.{4,255}$)([A-Z0-9_-]([A-Z0-9_-]{0,61}[A-Z0-9_-])?\.)"
+ br"{1,126}[A-Z0-9][A-Z0-9-]{0,61}[A-Z0-9]$", re.IGNORECASE)
_host_valid = re.compile(br"[A-Z0-9\-_]{1,63}$", re.IGNORECASE)