diff options
author | Ayush Gupta <AyushG3112@gmail.com> | 2018-05-02 21:51:20 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-05-18 16:24:05 +0300 |
commit | 11892b0b6422f6e983bfbde7ba342942dd2e2297 (patch) | |
tree | 4bae9cc12f532892305c971386253be5ce316cb5 /src/node_url.cc | |
parent | 9b24be1340b702131efcf3fd7a65b7ac4c269711 (diff) |
url: introduce `URL_FLAGS_IS_DEFAULT_SCHEME_PORT` flag
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 <jasnell@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r-- | src/node_url.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_url.cc b/src/node_url.cc index 42ecf47f4c9..82c093d516b 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1749,6 +1749,8 @@ void URL::Parse(const char* input, } // the port is valid url->port = NormalizePort(url->scheme, static_cast<int>(port)); + if (url->port == -1) + url->flags |= URL_FLAGS_IS_DEFAULT_SCHEME_PORT; buffer.clear(); } else if (has_state_override) { // TODO(TimothyGu): Similar case as above. |