Skip to content

Commit 012c3b2

Browse files
sp00mDjoykeAbyah
andauthored
Revert "Revert "feat(tls): allow disabling protocol upgrade (#1409)" (#1414)" (#1425)
This reverts commit cc52b02. Co-authored-by: Djoyke Reijans <115019123+DjoykeAbyah@users.noreply.github.com>
1 parent 5df1ba0 commit 012c3b2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/main/java/com/adyen/Config.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class Config {
1818
protected String apiKey;
1919
protected int connectionTimeoutMillis;
2020
protected int readTimeoutMillis;
21+
protected Boolean protocolUpgradeEnabled;
2122

2223
//Terminal API Specific
2324
protected String terminalApiCloudEndpoint;
@@ -111,6 +112,18 @@ public void setReadTimeoutMillis(int readTimeoutMillis) {
111112
this.readTimeoutMillis = readTimeoutMillis;
112113
}
113114

115+
public Boolean getProtocolUpgradeEnabled() {
116+
return protocolUpgradeEnabled;
117+
}
118+
119+
/**
120+
* Whether the HTTP requests should automatically attempt to upgrade to a safer/newer version of the protocol.
121+
* See also {@link RequestConfig.Builder#setProtocolUpgradeEnabled(boolean)}.
122+
*/
123+
public void setProtocolUpgradeEnabled(Boolean protocolUpgradeEnabled) {
124+
this.protocolUpgradeEnabled = protocolUpgradeEnabled;
125+
}
126+
114127
public String getLiveEndpointUrlPrefix() {
115128
return this.liveEndpointUrlPrefix;
116129
}

src/main/java/com/adyen/httpclient/AdyenHttpClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ private HttpUriRequestBase createRequest(String endpoint, String requestBody, Co
121121
if (config.getConnectionTimeoutMillis() > 0) {
122122
builder.setConnectTimeout(config.getConnectionTimeoutMillis(), TimeUnit.MILLISECONDS);
123123
}
124+
if (config.getProtocolUpgradeEnabled() != null) {
125+
builder.setProtocolUpgradeEnabled(config.getProtocolUpgradeEnabled());
126+
}
124127
if (proxy != null && proxy.address() instanceof InetSocketAddress) {
125128
InetSocketAddress inetSocketAddress = (InetSocketAddress) proxy.address();
126129
builder.setProxy(new HttpHost(inetSocketAddress.getHostName(), inetSocketAddress.getPort()));

0 commit comments

Comments
 (0)