mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: fix off-by-one error with parse()
Fixes: https://github.com/nodejs/node/issues/5393 PR-URL: https://github.com/nodejs/node/pull/5394 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Evan Lucas <evanlucas@me.com>
This commit is contained in:
1 parent
30cec18eeb
commit
dfe45f13e7
2 files changed
+16
-1
No files matched your search
+1
-1
@@ -413,7 +413,7 @@ function validateHostname(self, rest, hostname) {
|
||||
}
|
||||
// Invalid host character
|
||||
self.hostname = hostname.slice(0, i);
|
||||
if (i < hostname.length - 1)
|
||||
if (i < hostname.length)
|
||||
return '/' + hostname.slice(i) + rest;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -851,6 +851,21 @@ var parseTests = {
|
||||
pathname: '/:npm/npm',
|
||||
path: '/:npm/npm',
|
||||
href: 'git+ssh://git@github.com/:npm/npm'
|
||||
},
|
||||
|
||||
'https://*': {
|
||||
protocol: 'https:',
|
||||
slashes: true,
|
||||
auth: null,
|
||||
host: '',
|
||||
port: null,
|
||||
hostname: '',
|
||||
hash: null,
|
||||
search: null,
|
||||
query: null,
|
||||
pathname: '/*',
|
||||
path: '/*',
|
||||
href: 'https:///*'
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user