Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
url: forbid lt and gt in url host code point
As per the recent changes in whatwg/url spec. lt and gt are also added
in the list of forbidden hostCodePoint list.

Ref: whatwg/url#459
Ref: #33315
  • Loading branch information
yashLadha committed May 21, 2020
commit 5b9dac3dd78384e3db79a0ab728de920bdbf1080
3 changes: 2 additions & 1 deletion src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ CHAR_TEST(8, IsForbiddenHostCodePoint,
ch == '\0' || ch == '\t' || ch == '\n' || ch == '\r' ||
ch == ' ' || ch == '#' || ch == '%' || ch == '/' ||
ch == ':' || ch == '?' || ch == '@' || ch == '[' ||
ch == '\\' || ch == ']')
ch == '<' || ch == '>' || ch == '\\' || ch == ']' ||
ch == '^')

// https://url.spec.whatwg.org/#windows-drive-letter
TWO_CHAR_STRING_TEST(8, IsWindowsDriveLetter,
Expand Down
77 changes: 62 additions & 15 deletions test/fixtures/wpt/url/resources/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4481,21 +4481,6 @@
"search": "",
"hash": ""
},
{
"input": "sc://\u001F!\"$&'()*+,-.;<=>^_`{|}~/",
"base": "about:blank",
"href": "sc://%1F!\"$&'()*+,-.;<=>^_`{|}~/",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
"host": "%1F!\"$&'()*+,-.;<=>^_`{|}~",
"hostname": "%1F!\"$&'()*+,-.;<=>^_`{|}~",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "sc://\u0000/",
"base": "about:blank",
Expand Down Expand Up @@ -4649,6 +4634,68 @@
"search": "",
"hash": ""
},
"Forbidden host code points",
{
"input": "http://a<b",
"base": "about:blank",
"failure": true
},
{
"input": "http://a>b",
"base": "about:blank",
"failure": true
},
{
"input": "http://a^b",
"base": "about:blank",
"failure": true
},
{
"input": "non-special://a<b",
"base": "about:blank",
"failure": true
},
{
"input": "non-special://a>b",
"base": "about:blank",
"failure": true
},
{
"input": "non-special://a^b",
"base": "about:blank",
"failure": true
},
"Allowed host code points",
{
"input": "http://\u001F!\"$&'()*+,-.;=_`{|}~/",
"base": "about:blank",
"href": "http://\u001F!\"$&'()*+,-.;=_`{|}~/",
"origin": "http://\u001F!\"$&'()*+,-.;=_`{|}~",
"protocol": "http:",
"username": "",
"password": "",
"host": "\u001F!\"$&'()*+,-.;=_`{|}~",
"hostname": "\u001F!\"$&'()*+,-.;=_`{|}~",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "sc://\u001F!\"$&'()*+,-.;=_`{|}~/",
"base": "about:blank",
"href": "sc://%1F!\"$&'()*+,-.;=_`{|}~/",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
"host": "%1F!\"$&'()*+,-.;=_`{|}~",
"hostname": "%1F!\"$&'()*+,-.;=_`{|}~",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
"# Hosts and percent-encoding",
{
"input": "ftp://example.com%80/",
Expand Down