src/java.net.http/share/classes/jdk/internal/net/http/AbstractAsyncSSLConnection.java
branchhttp-client-branch
changeset 56137 dd867826d55b
parent 56126 86e628130926
child 56335 7e56c39fa1fa
--- 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));