Skip to content

Commit

Permalink
Forbid | in URL hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats committed Jan 28, 2022
1 parent fc76310 commit f0d1c7e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions url/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl Host<String> {
| ']'
| '^'
| '\u{007F}'
| '|'
)
};

Expand Down Expand Up @@ -146,6 +147,7 @@ impl Host<String> {
| '\\'
| ']'
| '^'
| '|'
)
};

Expand Down
45 changes: 45 additions & 0 deletions url/tests/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit f0d1c7e

Please sign in to comment.