Skip to content

Commit 2ff7d1e

Browse files
thecooldropvaniobegicjtnord
authored
Ensure that HTTP client can authenticate with proxy (#514)
* Ensure that HTTP client can authenticate with proxy The HTTP client can currently not use proxies which require authentication. By using a pre-configured base client this error should be mitigated * Apply Maven spotless plugin * Update pom.xml according to review comment Co-authored-by: James Nord <jtnord@users.noreply.github.com> Co-authored-by: Vanio Begic <vanio.begic@capgemini.com> Co-authored-by: James Nord <jtnord@users.noreply.github.com>
1 parent 2a67acc commit 2ff7d1e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
<artifactId>workflow-cps-global-lib</artifactId>
113113
<scope>test</scope>
114114
</dependency>
115+
<dependency>
116+
<groupId>io.jenkins.plugins</groupId>
117+
<artifactId>okhttp-api</artifactId>
118+
</dependency>
115119
</dependencies>
116120
<dependencyManagement>
117121
<dependencies>

src/main/java/org/jenkinsci/plugins/github_branch_source/Connector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import hudson.security.ACL;
5151
import hudson.util.FormValidation;
5252
import hudson.util.ListBoxModel;
53+
import io.jenkins.plugins.okhttp.api.JenkinsOkHttpClient;
5354
import java.io.File;
5455
import java.io.IOException;
5556
import java.net.HttpURLConnection;
@@ -100,7 +101,8 @@ public class Connector {
100101

101102
private static final Random ENTROPY = new Random();
102103
private static final String SALT = Long.toHexString(ENTROPY.nextLong());
103-
private static final OkHttpClient baseClient = new OkHttpClient();
104+
private static final OkHttpClient baseClient =
105+
JenkinsOkHttpClient.newClientBuilder(new OkHttpClient()).build();
104106

105107
private Connector() {
106108
throw new IllegalAccessError("Utility class");

0 commit comments

Comments
 (0)