url: fix inconsistent port in url.resolveObject
This commit fixes bug where url.resolveObject returns conflicting host and port values. Fixes: https://github.com/nodejs/node/issues/8213 PR-URL: https://github.com/nodejs/node/pull/8214 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
b4ea3a08f1
commit
286d44e43d
@ -781,6 +781,7 @@ Url.prototype.resolveObject = function(relative) {
|
||||
// it's absolute.
|
||||
if (relative.host || relative.host === '') {
|
||||
result.host = relative.host;
|
||||
result.port = relative.port;
|
||||
result.auth = null;
|
||||
}
|
||||
if (relative.hostname || relative.hostname === '') {
|
||||
|
@ -1570,6 +1570,11 @@ var relativeTests2 = [
|
||||
'http://asdf:qwer@www.example.com',
|
||||
'http://diff:auth@www.example.com/'],
|
||||
|
||||
// changing port
|
||||
['https://example.com:81/',
|
||||
'https://example.com:82/',
|
||||
'https://example.com:81/'],
|
||||
|
||||
// https://github.com/nodejs/node/issues/1435
|
||||
['https://another.host.com/',
|
||||
'https://user:password@example.org/',
|
||||
|
Loading…
x
Reference in New Issue
Block a user