Skip to content

Commit f91f40d

Browse files
committed
Fix and rename setDisableHttps setDisableAlgorithm, close AsyncHttpClient#1413
Motivation: * it’s buggy and actually sets useInsecureTrustManager * the name is not right Modifications: * change right property * rename into `setDisableHttpsEndpointIdentificationAlgorithm` Result: It’s now possible to disable HTTPS endpointIdentificationAlgorithm, for example in order to disable hostname verification.
1 parent 82a3e88 commit f91f40d

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

client/src/main/java/org/asynchttpclient/AsyncHttpClientConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public interface AsyncHttpClientConfig {
213213
/**
214214
* @return true to disable all HTTPS behaviors AT ONCE, such as hostname verification and SNI
215215
*/
216-
boolean isDisableHttpsAlgorithm();
216+
boolean isDisableHttpsEndpointIdentificationAlgorithm();
217217

218218
/**
219219
* @return the array of enabled protocols

client/src/main/java/org/asynchttpclient/DefaultAsyncHttpClientConfig.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public class DefaultAsyncHttpClientConfig implements AsyncHttpClientConfig {
9797
// ssl
9898
private final boolean useOpenSsl;
9999
private final boolean useInsecureTrustManager;
100-
private final boolean disableHttpsAlgorithm;
100+
private final boolean disableHttpsEndpointIdentificationAlgorithm;
101101
private final int handshakeTimeout;
102102
private final String[] enabledProtocols;
103103
private final String[] enabledCipherSuites;
@@ -172,7 +172,7 @@ private DefaultAsyncHttpClientConfig(//
172172
// ssl
173173
boolean useOpenSsl,//
174174
boolean useInsecureTrustManager,//
175-
boolean disableHttpsAlgorithm,//
175+
boolean disableHttpsEndpointIdentificationAlgorithm,//
176176
int handshakeTimeout,//
177177
String[] enabledProtocols,//
178178
String[] enabledCipherSuites,//
@@ -248,7 +248,7 @@ private DefaultAsyncHttpClientConfig(//
248248
// ssl
249249
this.useOpenSsl = useOpenSsl;
250250
this.useInsecureTrustManager = useInsecureTrustManager;
251-
this.disableHttpsAlgorithm = disableHttpsAlgorithm;
251+
this.disableHttpsEndpointIdentificationAlgorithm = disableHttpsEndpointIdentificationAlgorithm;
252252
this.handshakeTimeout = handshakeTimeout;
253253
this.enabledProtocols = enabledProtocols;
254254
this.enabledCipherSuites = enabledCipherSuites;
@@ -441,8 +441,8 @@ public boolean isUseInsecureTrustManager() {
441441
}
442442

443443
@Override
444-
public boolean isDisableHttpsAlgorithm() {
445-
return disableHttpsAlgorithm;
444+
public boolean isDisableHttpsEndpointIdentificationAlgorithm() {
445+
return disableHttpsEndpointIdentificationAlgorithm;
446446
}
447447

448448
@Override
@@ -655,7 +655,7 @@ public static class Builder {
655655
// ssl
656656
private boolean useOpenSsl = defaultUseOpenSsl();
657657
private boolean useInsecureTrustManager = defaultUseInsecureTrustManager();
658-
private boolean disableHttpsAlgorithm = defaultDisableHttpsAlgorithm();
658+
private boolean disableHttpsEndpointIdentificationAlgorithm = defaultDisableHttpsEndpointIdentificationAlgorithm();
659659
private int handshakeTimeout = defaultHandshakeTimeout();
660660
private String[] enabledProtocols = defaultEnabledProtocols();
661661
private String[] enabledCipherSuites = defaultEnabledCipherSuites();
@@ -934,8 +934,8 @@ public Builder setUseInsecureTrustManager(boolean useInsecureTrustManager) {
934934
return this;
935935
}
936936

937-
public Builder setDisableHttpsAlgorithm(boolean disableHttpsAlgorithm) {
938-
this.useInsecureTrustManager = disableHttpsAlgorithm;
937+
public Builder setDisableHttpsEndpointIdentificationAlgorithm(boolean disableHttpsEndpointIdentificationAlgorithm) {
938+
this.disableHttpsEndpointIdentificationAlgorithm = disableHttpsEndpointIdentificationAlgorithm;
939939
return this;
940940
}
941941

@@ -1167,7 +1167,7 @@ public DefaultAsyncHttpClientConfig build() {
11671167
keepAliveStrategy, //
11681168
useOpenSsl, //
11691169
useInsecureTrustManager, //
1170-
disableHttpsAlgorithm, //
1170+
disableHttpsEndpointIdentificationAlgorithm, //
11711171
handshakeTimeout, //
11721172
enabledProtocols, //
11731173
enabledCipherSuites, //

client/src/main/java/org/asynchttpclient/config/AsyncHttpClientConfigDefaults.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ public static boolean defaultUseInsecureTrustManager() {
119119
return AsyncHttpClientConfigHelper.getAsyncHttpClientConfig().getBoolean(ASYNC_CLIENT_CONFIG_ROOT + "useInsecureTrustManager");
120120
}
121121

122-
public static boolean defaultDisableHttpsAlgorithm() {
123-
return AsyncHttpClientConfigHelper.getAsyncHttpClientConfig().getBoolean(ASYNC_CLIENT_CONFIG_ROOT + "disableHttpsAlgorithm");
122+
public static boolean defaultDisableHttpsEndpointIdentificationAlgorithm() {
123+
return AsyncHttpClientConfigHelper.getAsyncHttpClientConfig().getBoolean(ASYNC_CLIENT_CONFIG_ROOT + "disableHttpsEndpointIdentificationAlgorithm");
124124
}
125125

126126
public static int defaultSslSessionCacheSize() {

client/src/main/java/org/asynchttpclient/netty/ssl/SslEngineFactoryBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class SslEngineFactoryBase implements SslEngineFactory {
2323

2424
protected void configureSslEngine(SSLEngine sslEngine, AsyncHttpClientConfig config) {
2525
sslEngine.setUseClientMode(true);
26-
if (!config.isDisableHttpsAlgorithm()) {
26+
if (!config.isDisableHttpsEndpointIdentificationAlgorithm()) {
2727
SSLParameters params = sslEngine.getSSLParameters();
2828
params.setEndpointIdentificationAlgorithm("HTTPS");
2929
sslEngine.setSSLParameters(params);

client/src/main/resources/ahc-default.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ org.asynchttpclient.disableUrlEncodingForBoundRequests=false
2424
org.asynchttpclient.removeQueryParamOnRedirect=true
2525
org.asynchttpclient.useOpenSsl=false
2626
org.asynchttpclient.useInsecureTrustManager=false
27-
org.asynchttpclient.disableHttpsAlgorithm=false
27+
org.asynchttpclient.disableHttpsEndpointIdentificationAlgorithm=false
2828
org.asynchttpclient.sslSessionCacheSize=0
2929
org.asynchttpclient.sslSessionTimeout=0
3030
org.asynchttpclient.tcpNoDelay=true

0 commit comments

Comments
 (0)