mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Merge pull request #1905 from chhsiao90/allow-underscore-hostname
Allow underscore in hostname
This commit is contained in:
commit
e83083b64e
@ -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