src/java.net.http/share/classes/jdk/internal/net/http/AbstractAsyncSSLConnection.java
--- a/src/java.net.http/share/classes/jdk/internal/net/http/AbstractAsyncSSLConnection.java Thu Feb 15 20:09:01 2018 +0000
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/AbstractAsyncSSLConnection.java Fri Feb 16 10:34:17 2018 +0000
@@ -67,6 +67,10 @@
protected final String serverName;
protected final SSLParameters sslParameters;
+ // Setting this property disables HTTPS hostname verification. Use with care.
+ private static final boolean disableHostnameVerification = Utils.isHostnameVerificationDisabled();
+
+
AbstractAsyncSSLConnection(InetSocketAddress addr,
HttpClientImpl client,
String serverName, int port,
@@ -94,7 +98,8 @@
String[] alpn) {
SSLParameters sslp = client.sslParameters();
SSLParameters sslParameters = Utils.copySSLParameters(sslp);
- sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
+ if (!disableHostnameVerification)
+ sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
if (alpn != null) {
Log.logSSL("AbstractAsyncSSLConnection: Setting application protocols: {0}",
Arrays.toString(alpn));