Skip to content

Commit

Permalink
Fix list of non proxy hosts (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dohbedoh authored Oct 24, 2023
1 parent 685d5d0 commit 855da0b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import jenkins.util.JenkinsJVM;

import java.net.InetSocketAddress;
import java.util.Arrays;
import java.util.stream.Collectors;

import jenkins.util.SystemProperties;

public class HttpClientRetriever {
Expand Down Expand Up @@ -40,7 +43,11 @@ public static HttpClient get(ProxyConfiguration proxy) {
}
String noProxyHost = Util.fixEmpty(proxy.getNoProxyHost());
if (noProxyHost != null) {
proxyOptions.setNonProxyHosts(noProxyHost);
// com.azure.core.http.ProxyOptions accepts a '|' delimited String
// https://learn.microsoft.com/en-us/java/api/com.azure.core.http.proxyoptions?view=azure-java-stable#com-azure-core-http-proxyoptions-setnonproxyhosts(java-lang-string)
proxyOptions.setNonProxyHosts(Arrays.stream(noProxyHost.split("[ \t\n,|]+"))
.filter(s -> !s.isEmpty())
.collect(Collectors.joining("|")));

Check warning on line 50 in src/main/java/io/jenkins/plugins/azuresdk/HttpClientRetriever.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 48-50 are not covered by tests
}
}

Expand Down

0 comments on commit 855da0b

Please sign in to comment.