Skip to content

Commit 1624da4

Browse files
SNOW-902727: Use proxy user and password from env vars (#1513)
1 parent fa658a4 commit 1624da4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/main/java/net/snowflake/client/core/SFBaseSession.java

+15-6
Original file line numberDiff line numberDiff line change
@@ -392,21 +392,30 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException {
392392
boolean httpUseProxy = Boolean.parseBoolean(systemGetProperty("http.useProxy"));
393393
String httpProxyHost = systemGetProperty("http.proxyHost");
394394
String httpProxyPort = systemGetProperty("http.proxyPort");
395+
String httpProxyUser = systemGetProperty("http.proxyUser");
396+
String httpProxyPassword = systemGetProperty("http.proxyPassword");
395397
String httpsProxyHost = systemGetProperty("https.proxyHost");
396398
String httpsProxyPort = systemGetProperty("https.proxyPort");
399+
String httpsProxyUser = systemGetProperty("https.proxyUser");
400+
String httpsProxyPassword = systemGetProperty("https.proxyPassword");
397401
String httpProxyProtocol = systemGetProperty("http.proxyProtocol");
398402
String noProxy = systemGetEnv("NO_PROXY");
399403
String nonProxyHosts = systemGetProperty("http.nonProxyHosts");
400404
// log the JVM parameters that are being used
401405
if (httpUseProxy) {
402406
logger.debug(
403-
"http.useProxy={}, http.proxyHost={}, http.proxyPort={}, https.proxyHost={},"
404-
+ " https.proxyPort={}, http.nonProxyHosts={}, NO_PROXY={}, http.proxyProtocol={}",
407+
"Proxy environment settings: http.useProxy={}, http.proxyHost={}, http.proxyPort={}, http.proxyUser={}, "
408+
+ "http.proxyPassword is {}, https.proxyHost={}, https.proxyPort={}, https.proxyUser={}, "
409+
+ "https.proxyPassword is {}, http.nonProxyHosts={}, NO_PROXY={}, http.proxyProtocol={}",
405410
httpUseProxy,
406411
httpProxyHost,
407412
httpProxyPort,
413+
httpProxyUser,
414+
httpProxyPassword == null || httpProxyPassword.isEmpty() ? "not set" : "set",
408415
httpsProxyHost,
409416
httpsProxyPort,
417+
httpsProxyUser,
418+
httpsProxyPassword == null || httpsProxyPassword.isEmpty() ? "not set" : "set",
410419
nonProxyHosts,
411420
noProxy,
412421
httpProxyProtocol,
@@ -447,8 +456,8 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException {
447456
httpsProxyHost,
448457
proxyPort,
449458
combinedNonProxyHosts,
450-
"", /* user = empty */
451-
"", /* password = empty */
459+
httpsProxyUser,
460+
httpsProxyPassword,
452461
"https",
453462
userAgentSuffix,
454463
gzipDisabled);
@@ -468,8 +477,8 @@ public HttpClientSettingsKey getHttpClientKey() throws SnowflakeSQLException {
468477
httpProxyHost,
469478
proxyPort,
470479
combinedNonProxyHosts,
471-
"", /* user = empty */
472-
"", /* password = empty */
480+
httpProxyUser,
481+
httpProxyPassword,
473482
"http",
474483
userAgentSuffix,
475484
gzipDisabled);

0 commit comments

Comments
 (0)