From ba8b70dca00bd2d6902d655350bf4b1165ae755c Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 26 Nov 2024 14:45:21 +0100 Subject: [PATCH] SNOW-1825719 - setting proxy port if default was skipped during parsing --- lib/util.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/util.js b/lib/util.js index 3147ef848..90db5d079 100644 --- a/lib/util.js +++ b/lib/util.js @@ -862,9 +862,10 @@ exports.validateEmptyString = function (value) { }; exports.getProxyFromEnv = function (isHttps = true) { - const getDefaultPortIfNotSet = (proxyFromEnv, isHttps) => { + const getDefaultPortIfNotSet = (proxyFromEnv) => { + const isProxyProtocolHttps = proxyFromEnv.protocol === 'https:'; if (!proxyFromEnv.port) { - return isHttps ? 443 : 80; + return isProxyProtocolHttps ? 443 : 80; } else { return proxyFromEnv.port; } @@ -879,10 +880,9 @@ exports.getProxyFromEnv = function (isHttps = true) { if (proxyFromEnv.indexOf('://') === -1) { Logger.getInstance().info('Util.getProxyEnv: the protocol was missing from the environment proxy. Use the HTTP protocol.'); proxyFromEnv = 'http' + '://' + proxyFromEnv; - isHttps = false; } proxyFromEnv = new URL(proxyFromEnv); - const port = getDefaultPortIfNotSet(proxyFromEnv, isHttps); + const port = getDefaultPortIfNotSet(proxyFromEnv); const proxy = { host: this.validateEmptyString(proxyFromEnv.hostname), port: Number(port),