Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 14c7dcb

Browse filesBrowse files
imyllerevanlucas
authored andcommitted
url: fix inconsistent port in url.resolveObject
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>
1 parent d863619 commit 14c7dcb
Copy full SHA for 14c7dcb

File tree

Expand file treeCollapse file tree

2 files changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎lib/url.js‎

Copy file name to clipboardExpand all lines: lib/url.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ Url.prototype.resolveObject = function(relative) {
776776
// it's absolute.
777777
if (relative.host || relative.host === '') {
778778
result.host = relative.host;
779+
result.port = relative.port;
779780
result.auth = null;
780781
}
781782
if (relative.hostname || relative.hostname === '') {
Collapse file

‎test/parallel/test-url.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-url.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,11 @@ var relativeTests2 = [
15401540
'http://asdf:qwer@www.example.com',
15411541
'http://diff:auth@www.example.com/'],
15421542

1543+
// changing port
1544+
['https://example.com:81/',
1545+
'https://example.com:82/',
1546+
'https://example.com:81/'],
1547+
15431548
// https://github.com/nodejs/node/issues/1435
15441549
['https://another.host.com/',
15451550
'https://user:password@example.org/',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.