From a1a8a40804eb95af9ea41e06a6f800d435e99f5e Mon Sep 17 00:00:00 2001 From: sfc-gh-spanaite Date: Tue, 19 Sep 2023 09:45:18 +0200 Subject: [PATCH] Fix for Github issue 629 (SNOW-902727) --- .../snowflake/client/core/SFBaseSession.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/SFBaseSession.java b/src/main/java/net/snowflake/client/core/SFBaseSession.java index fa32ac19a..36a3f659d 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseSession.java +++ b/src/main/java/net/snowflake/client/core/SFBaseSession.java @@ -372,21 +372,31 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException { boolean httpUseProxy = Boolean.parseBoolean(systemGetProperty("http.useProxy")); String httpProxyHost = systemGetProperty("http.proxyHost"); String httpProxyPort = systemGetProperty("http.proxyPort"); + String httpProxyUser = (systemGetProperty("http.proxyUser") != null) ? systemGetProperty("http.proxyUser") : ""; + String httpProxyPassword = (systemGetProperty("http.proxyPassword") != null) ? systemGetProperty("http.proxyPassword") : ""; String httpsProxyHost = systemGetProperty("https.proxyHost"); String httpsProxyPort = systemGetProperty("https.proxyPort"); + String httpsProxyUser = (systemGetProperty("https.proxyUser") != null) ? systemGetProperty("https.proxyUser") : ""; + String httpsProxyPassword = (systemGetProperty("https.proxyPassword") != null) ? systemGetProperty("https.proxyPassword") : ""; String httpProxyProtocol = systemGetProperty("http.proxyProtocol"); String noProxy = systemGetEnv("NO_PROXY"); String nonProxyHosts = systemGetProperty("http.nonProxyHosts"); // log the JVM parameters that are being used if (httpUseProxy) { logger.debug( - "http.useProxy={}, http.proxyHost={}, http.proxyPort={}, https.proxyHost={}," - + " https.proxyPort={}, http.nonProxyHosts={}, NO_PROXY={}, http.proxyProtocol={}", + "http.useProxy={}, http.proxyHost={}, http.proxyPort={}, http.proxyUser={}," + + "http.proxyPassword={}, https.proxyHost={}, https.proxyPort={}, " + + "https.proxyUser={}, https.proxyPassword={}, http.nonProxyHosts={}," + + "NO_PROXY={}, http.proxyProtocol={}", httpUseProxy, httpProxyHost, httpProxyPort, + httpProxyUser, + httpProxyPassword, httpsProxyHost, httpsProxyPort, + httpsProxyUser, + httpsProxyPassword, nonProxyHosts, noProxy, httpProxyProtocol, @@ -427,8 +437,8 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException { httpsProxyHost, proxyPort, combinedNonProxyHosts, - "", /* user = empty */ - "", /* password = empty */ + httpsProxyUser, + httpsProxyPassword, "https", userAgentSuffix, gzipDisabled); @@ -448,8 +458,8 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException { httpProxyHost, proxyPort, combinedNonProxyHosts, - "", /* user = empty */ - "", /* password = empty */ + httpProxyUser, + httpProxyPassword, "http", userAgentSuffix, gzipDisabled);