Add support for exotic TLDs.

Indeed, before this patch, we were not supporting TLD which
contains digits and dashes (-) when "puny-encoded".
This commit is contained in:
funilrys
2023-08-10 16:33:53 +02:00
parent 2415078892
commit 560615dd7f
2 changed files with 11 additions and 3 deletions

View File

@@ -840,9 +840,12 @@ class TestNormalizeRule(BaseStdout):
# Note: "Bare"- Domains are accepted. IP are excluded.
for rule in [
"128.0.0.1",
"::1",
"0.0.0.0 128.0.0.2",
"0.0.0 google",
"0.1.2.3.4 foo/bar",
"0.0.0.0 https",
"0.0.0.0 https..",
]:
self.assertEqual(normalize_rule(rule, **kwargs), (None, None))
@@ -905,7 +908,7 @@ class TestNormalizeRule(BaseStdout):
sys.stdout = StringIO()
def test_no_comment_raw(self):
for rule in ("twitter.com", "google.com", "foo.bar.edu", "www.example-foo.bar.edu", "www.example-3045.foobar.com"):
for rule in ("twitter.com", "google.com", "foo.bar.edu", "www.example-foo.bar.edu", "www.example-3045.foobar.com", "www.example.xn--p1ai"):
expected = (rule, "0.0.0.0 " + rule + "\n")
actual = normalize_rule(