diff options
author | Wojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com> | 2023-11-07 14:16:43 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-08 20:02:51 +0000 |
commit | 3c40fffa36a740785892e8963916b07b4a5faed5 (patch) | |
tree | 714de58d7cd7e06ee6847dfde646932b7e7b58c9 /server | |
parent | 6c525fc50c21c84015497eb31ab8ef47aece1e2e (diff) | |
download | sonarqube-3c40fffa36a740785892e8963916b07b4a5faed5.tar.gz sonarqube-3c40fffa36a740785892e8963916b07b4a5faed5.zip |
SONAR-20540 Use proxy settings in DefaultHttpDownloader
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java | 5 | ||||
-rw-r--r-- | server/sonar-server-common/src/test/java/org/sonar/server/util/OkHttpClientProviderTest.java | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java index 54b1786dc35..a1bda954d3a 100644 --- a/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java +++ b/server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java @@ -30,6 +30,7 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; import javax.annotation.Nullable; +import org.sonar.core.config.ProxyProperties; import org.sonar.core.extension.CoreExtension; import org.sonar.core.extension.ServiceLoaderWrapper; @@ -112,8 +113,8 @@ public class ProcessProperties { HTTPS_PROXY_HOST("https.proxyHost"), HTTP_PROXY_PORT("http.proxyPort"), HTTPS_PROXY_PORT("https.proxyPort"), - HTTP_PROXY_USER("http.proxyUser"), - HTTP_PROXY_PASSWORD("http.proxyPassword"), + HTTP_PROXY_USER(ProxyProperties.HTTP_PROXY_USER), + HTTP_PROXY_PASSWORD(ProxyProperties.HTTP_PROXY_PASSWORD), HTTP_NON_PROXY_HOSTS("http.nonProxyHosts", "localhost|127.*|[::1]"), HTTP_AUTH_NTLM_DOMAIN("http.auth.ntlm.domain"), SOCKS_PROXY_HOST("socksProxyHost"), diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/util/OkHttpClientProviderTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/util/OkHttpClientProviderTest.java index 671e21dbd1e..74d30b82651 100644 --- a/server/sonar-server-common/src/test/java/org/sonar/server/util/OkHttpClientProviderTest.java +++ b/server/sonar-server-common/src/test/java/org/sonar/server/util/OkHttpClientProviderTest.java @@ -35,6 +35,8 @@ import org.sonar.api.utils.Version; import org.sonar.core.platform.SonarQubeVersion; import static org.assertj.core.api.Assertions.assertThat; +import static org.sonar.core.config.ProxyProperties.HTTP_PROXY_PASSWORD; +import static org.sonar.core.config.ProxyProperties.HTTP_PROXY_USER; public class OkHttpClientProviderTest { @@ -60,8 +62,8 @@ public class OkHttpClientProviderTest { @Test public void get_returns_a_OkHttpClient_with_proxy_authentication() throws Exception { - settings.setProperty("http.proxyUser", "the-login"); - settings.setProperty("http.proxyPassword", "the-password"); + settings.setProperty(HTTP_PROXY_USER, "the-login"); + settings.setProperty(HTTP_PROXY_PASSWORD, "the-password"); OkHttpClient client = underTest.provide(settings.asConfig(), sonarQubeVersion); Response response = new Response.Builder().protocol(Protocol.HTTP_1_1).request(new Request.Builder().url("http://foo").build()).code(407) |