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 <jasnell@gmail.com>
  • Loading branch information
imyller authored and evanlucas committed Aug 24, 2016
1 parent d863619 commit 14c7dcb
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 @@ -776,6 +776,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 @@ -1540,6 +1540,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/',
Expand Down

0 comments on commit 14c7dcb

Please sign in to comment.