aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/main/java/org/sonarqube
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-ws/src/main/java/org/sonarqube')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpClientBuilder.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpClientBuilder.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpClientBuilder.java
index ede86381037..aa3a736eb4c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpClientBuilder.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/OkHttpClientBuilder.java
@@ -67,6 +67,7 @@ public class OkHttpClientBuilder {
private String credentials;
private String proxyLogin;
private String proxyPassword;
+ private Boolean followRedirects;
private long connectTimeoutMs = -1;
private long readTimeoutMs = -1;
private SSLSocketFactory sslSocketFactory = null;
@@ -159,6 +160,15 @@ public class OkHttpClientBuilder {
return this;
}
+ /**
+ * Set if redirects should be followed or not.
+ * Default is defined by OkHttp (true, follow redirects).
+ */
+ public OkHttpClientBuilder setFollowRedirects(Boolean followRedirects) {
+ this.followRedirects = followRedirects;
+ return this;
+ }
+
public OkHttpClient build() {
OkHttpClient.Builder builder = new OkHttpClient.Builder();
builder.proxy(proxy);
@@ -182,6 +192,10 @@ public class OkHttpClientBuilder {
return null;
});
}
+ if (followRedirects != null) {
+ builder.followRedirects(followRedirects);
+ builder.followSslRedirects(followRedirects);
+ }
ConnectionSpec tls = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.allEnabledTlsVersions()