mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 08:11:00 +00:00
Allow underscore in hostname
This commit is contained in:
parent
973406f327
commit
a5f1215eb2
@ -1,6 +1,7 @@
|
||||
import re
|
||||
|
||||
_label_valid = re.compile(b"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
|
||||
# Allow underscore in host name
|
||||
_label_valid = re.compile(b"(?!-)[A-Z\d\-_]{1,63}(?<!-)$", re.IGNORECASE)
|
||||
|
||||
|
||||
def is_valid_host(host: bytes) -> bool:
|
||||
|
@ -8,3 +8,5 @@ def test_is_valid_host():
|
||||
assert check.is_valid_host(b"one.two")
|
||||
assert not check.is_valid_host(b"one" * 255)
|
||||
assert check.is_valid_host(b"one.two.")
|
||||
# Allow underscore
|
||||
assert check.is_valid_host(b"one_two")
|
||||
|
Loading…
Reference in New Issue
Block a user