Skip to content

Commit

Permalink
Revert "Revert "feat(tls): allow disabling protocol upgrade (Adyen#1409
Browse files Browse the repository at this point in the history
…)" (Adyen#1414)"

This reverts commit cc52b02.
  • Loading branch information
sp00m authored Feb 3, 2025
1 parent d9f9b11 commit eb38bb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/com/adyen/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Config {
protected String apiKey;
protected int connectionTimeoutMillis;
protected int readTimeoutMillis;
protected Boolean protocolUpgradeEnabled;

//Terminal API Specific
protected String terminalApiCloudEndpoint;
Expand Down Expand Up @@ -111,6 +112,18 @@ public void setReadTimeoutMillis(int readTimeoutMillis) {
this.readTimeoutMillis = readTimeoutMillis;
}

public Boolean getProtocolUpgradeEnabled() {
return protocolUpgradeEnabled;
}

/**
* Whether the HTTP requests should automatically attempt to upgrade to a safer/newer version of the protocol.
* See also {@link RequestConfig.Builder#setProtocolUpgradeEnabled(boolean)}.
*/
public void setProtocolUpgradeEnabled(Boolean protocolUpgradeEnabled) {
this.protocolUpgradeEnabled = protocolUpgradeEnabled;
}

public String getLiveEndpointUrlPrefix() {
return this.liveEndpointUrlPrefix;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/adyen/httpclient/AdyenHttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ private HttpUriRequestBase createRequest(String endpoint, String requestBody, Co
if (config.getConnectionTimeoutMillis() > 0) {
builder.setConnectTimeout(config.getConnectionTimeoutMillis(), TimeUnit.MILLISECONDS);
}
if (config.getProtocolUpgradeEnabled() != null) {
builder.setProtocolUpgradeEnabled(config.getProtocolUpgradeEnabled());
}
if (proxy != null && proxy.address() instanceof InetSocketAddress) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) proxy.address();
builder.setProxy(new HttpHost(inetSocketAddress.getHostName(), inetSocketAddress.getPort()));
Expand Down

0 comments on commit eb38bb0

Please sign in to comment.