Skip to content

Commit

Permalink
url: fix inconsistent port in url.resolveObject
Browse files Browse the repository at this point in the history
This commit fixes bug where url.resolveObject returns conflicting
host and port values.

Fixes: #8213
PR-URL: #8214
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
imyller authored and jasnell committed Aug 23, 2016
1 parent b4ea3a0 commit 286d44e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 === '') {
Expand Down
5 changes: 5 additions & 0 deletions test/parallel/test-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,11 @@ var relativeTests2 = [
'http://asdf:[email protected]',
'http://diff:[email protected]/'],

// 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:[email protected]/',
Expand Down

0 comments on commit 286d44e

Please sign in to comment.