From 3c40fffa36a740785892e8963916b07b4a5faed5 Mon Sep 17 00:00:00 2001 From: Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:16:43 +0100 Subject: SONAR-20540 Use proxy settings in DefaultHttpDownloader --- .../java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sonar-scanner-engine/src') diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java index c38ad36fd31..098cc0b19c2 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClientProvider.java @@ -30,6 +30,8 @@ import org.springframework.context.annotation.Bean; import static java.lang.Integer.parseInt; import static java.lang.String.valueOf; import static org.apache.commons.lang.StringUtils.defaultIfBlank; +import static org.sonar.core.config.ProxyProperties.HTTP_PROXY_PASSWORD; +import static org.sonar.core.config.ProxyProperties.HTTP_PROXY_USER; public class ScannerWsClientProvider { static final int CONNECT_TIMEOUT_MS = 5_000; @@ -56,9 +58,9 @@ public class ScannerWsClientProvider { .credentials(login, scannerProps.property(CoreProperties.PASSWORD)); // OkHttp detect 'http.proxyHost' java property, but credentials should be filled - final String proxyUser = System.getProperty("http.proxyUser", ""); + final String proxyUser = System.getProperty(HTTP_PROXY_USER, ""); if (!proxyUser.isEmpty()) { - connectorBuilder.proxyCredentials(proxyUser, System.getProperty("http.proxyPassword")); + connectorBuilder.proxyCredentials(proxyUser, System.getProperty(HTTP_PROXY_PASSWORD)); } return new DefaultScannerWsClient(WsClientFactories.getDefault().newClient(connectorBuilder.build()), login != null, -- cgit v1.2.3