mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: change null password handling
Pulls in new URL parsing tests from w3c web-platform-tests and updates null password handling. Refs: https://github.com/w3c/web-platform-tests/commit/e0012406859014e8f31dbaf12122d0cd10249db4 Refs: https://github.com/whatwg/url/pull/186 PR-URL: https://github.com/nodejs/node/pull/10601 Fixes: https://github.com/nodejs/node/issues/10595 Reviewed-By: Michal Zasso <targos@protonmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
1 parent
f380a5fb5a
commit
e46bdcf2bb
2 files changed
+66
-5
No files matched your search
+2
-1
@@ -285,7 +285,8 @@ Object.defineProperties(URL.prototype, {
|
||||
if (ctx.host !== undefined) {
|
||||
ret += '//';
|
||||
const has_username = typeof ctx.username === 'string';
|
||||
const has_password = typeof ctx.password === 'string';
|
||||
const has_password = typeof ctx.password === 'string' &&
|
||||
ctx.password !== '';
|
||||
if (has_username || has_password) {
|
||||
if (has_username)
|
||||
ret += ctx.username;
|
||||
|
||||
Vendored
+64
-4
@@ -32,6 +32,66 @@
|
||||
"search": "?b",
|
||||
"hash": "#c"
|
||||
},
|
||||
{
|
||||
"input": "https://test:@test",
|
||||
"base": "about:blank",
|
||||
"href": "https://test@test/",
|
||||
"origin": "https://test",
|
||||
"protocol": "https:",
|
||||
"username": "test",
|
||||
"password": "",
|
||||
"host": "test",
|
||||
"hostname": "test",
|
||||
"port": "",
|
||||
"pathname": "/",
|
||||
"search": "",
|
||||
"hash": ""
|
||||
},
|
||||
{
|
||||
"input": "https://:@test",
|
||||
"base": "about:blank",
|
||||
"href": "https://test/",
|
||||
"origin": "https://test",
|
||||
"protocol": "https:",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"host": "test",
|
||||
"hostname": "test",
|
||||
"port": "",
|
||||
"pathname": "/",
|
||||
"search": "",
|
||||
"hash": ""
|
||||
},
|
||||
{
|
||||
"input": "non-special://test:@test/x",
|
||||
"base": "about:blank",
|
||||
"href": "non-special://test@test/x",
|
||||
"origin": "null",
|
||||
"protocol": "non-special:",
|
||||
"username": "test",
|
||||
"password": "",
|
||||
"host": "test",
|
||||
"hostname": "test",
|
||||
"port": "",
|
||||
"pathname": "/x",
|
||||
"search": "",
|
||||
"hash": ""
|
||||
},
|
||||
{
|
||||
"input": "non-special://:@test/x",
|
||||
"base": "about:blank",
|
||||
"href": "non-special://test/x",
|
||||
"origin": "null",
|
||||
"protocol": "non-special:",
|
||||
"username": "",
|
||||
"password": "",
|
||||
"host": "test",
|
||||
"hostname": "test",
|
||||
"port": "",
|
||||
"pathname": "/x",
|
||||
"search": "",
|
||||
"hash": ""
|
||||
},
|
||||
{
|
||||
"input": "http:foo.com",
|
||||
"base": "http://example.org/foo/bar",
|
||||
@@ -3098,7 +3158,7 @@
|
||||
{
|
||||
"input": "http:a:@www.example.com",
|
||||
"base": "about:blank",
|
||||
"href": "http://a:@www.example.com/",
|
||||
"href": "http://a@www.example.com/",
|
||||
"origin": "http://www.example.com",
|
||||
"protocol": "http:",
|
||||
"username": "a",
|
||||
@@ -3113,7 +3173,7 @@
|
||||
{
|
||||
"input": "http:/a:@www.example.com",
|
||||
"base": "about:blank",
|
||||
"href": "http://a:@www.example.com/",
|
||||
"href": "http://a@www.example.com/",
|
||||
"origin": "http://www.example.com",
|
||||
"protocol": "http:",
|
||||
"username": "a",
|
||||
@@ -3128,7 +3188,7 @@
|
||||
{
|
||||
"input": "http://a:@www.example.com",
|
||||
"base": "about:blank",
|
||||
"href": "http://a:@www.example.com/",
|
||||
"href": "http://a@www.example.com/",
|
||||
"origin": "http://www.example.com",
|
||||
"protocol": "http:",
|
||||
"username": "a",
|
||||
@@ -3173,7 +3233,7 @@
|
||||
{
|
||||
"input": "http://:@www.example.com",
|
||||
"base": "about:blank",
|
||||
"href": "http://:@www.example.com/",
|
||||
"href": "http://www.example.com/",
|
||||
"origin": "http://www.example.com",
|
||||
"protocol": "http:",
|
||||
"username": "",
|
||||
|
||||
Reference in new issue
Block a user