diff --git a/url/src/host.rs b/url/src/host.rs index d0a559589..c150dd997 100644 --- a/url/src/host.rs +++ b/url/src/host.rs @@ -90,24 +90,21 @@ impl Host { } let is_invalid_domain_char = |c| { - matches!( - c, - | '\0'..='\u{001F}' - | ' ' - | '#' - | '%' - | '/' - | ':' - | '<' - | '>' - | '?' - | '@' - | '[' - | '\\' - | ']' - | '^' - | '\u{007F}' - ) + matches!(c, |'\0'..='\u{001F}'| ' ' + | '#' + | '%' + | '/' + | ':' + | '<' + | '>' + | '?' + | '@' + | '[' + | '\\' + | ']' + | '^' + | '\u{007F}' + | '|') }; if domain.find(is_invalid_domain_char).is_some() { @@ -146,6 +143,7 @@ impl Host { | '\\' | ']' | '^' + | '|' ) }; diff --git a/url/tests/urltestdata.json b/url/tests/urltestdata.json index 290932785..c1f424d99 100644 --- a/url/tests/urltestdata.json +++ b/url/tests/urltestdata.json @@ -4707,6 +4707,11 @@ "base": "about:blank", "failure": true }, + { + "input": "sc://a|b/", + "base": "about:blank", + "failure": true + }, "Forbidden host codepoints: tabs and newlines are removed during preprocessing", { "input": "foo://ho\u0009st/", @@ -4931,6 +4936,11 @@ "base": "about:blank", "failure": true }, + { + "input": "http://a|b/", + "base": "about:blank", + "failure": true + }, { "input": "http://a\u007Fb/", "base": "about:blank", @@ -5200,6 +5210,11 @@ "base": "about:blank", "failure": true }, + { + "input": "http://ho%7Cst/", + "base": "about:blank", + "failure": true + }, { "input": "http://ho%7Fst/", "base": "about:blank", @@ -5777,6 +5792,36 @@ "base": "about:blank", "failure": true }, + { + "input": "file://%43%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43|", + "base": "about:blank", + "failure": true + }, + { + "input": "file://C%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43%7C/", + "base": "about:blank", + "failure": true + }, + { + "input": "https://%43%7C/", + "base": "about:blank", + "failure": true + }, + { + "input": "asdf://%43|/", + "base": "about:blank", + "failure": true + }, { "input": "asdf://%43%7C/", "base": "about:blank",