From 11892b0b6422f6e983bfbde7ba342942dd2e2297 Mon Sep 17 00:00:00 2001 From: Ayush Gupta Date: Thu, 3 May 2018 00:21:20 +0530 Subject: url: introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag which is retured when the parser detects that the port passed is the default port for that scheme. PR-URL: https://github.com/nodejs/node/pull/20479 Fixes: https://github.com/nodejs/node/issues/20465 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Anatoli Papirovski Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Ruben Bridgewater --- lib/internal/url.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/internal/url.js') diff --git a/lib/internal/url.js b/lib/internal/url.js index d9daef1524..7a67fe2f15 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -46,6 +46,7 @@ const { URL_FLAGS_HAS_PATH, URL_FLAGS_HAS_QUERY, URL_FLAGS_HAS_USERNAME, + URL_FLAGS_IS_DEFAULT_SCHEME_PORT, URL_FLAGS_SPECIAL, kFragment, kHost, @@ -276,7 +277,7 @@ function onParsePortComplete(flags, protocol, username, password, function onParseHostComplete(flags, protocol, username, password, host, port, path, query, fragment) { onParseHostnameComplete.apply(this, arguments); - if (port !== null) + if (port !== null || ((flags & URL_FLAGS_IS_DEFAULT_SCHEME_PORT) !== 0)) onParsePortComplete.apply(this, arguments); } -- cgit v1.2.3