src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java
branchhttp-client-branch
changeset 56137 dd867826d55b
parent 56126 86e628130926
child 56165 8a6065d830b9
equal deleted inserted replaced
56136:3b58e5bacad6 56137:dd867826d55b
    87             getBooleanProperty(DebugLogger.HTTP_NAME, false);
    87             getBooleanProperty(DebugLogger.HTTP_NAME, false);
    88     public static final boolean DEBUG_HPACK = // Revisit: temporary dev flag.
    88     public static final boolean DEBUG_HPACK = // Revisit: temporary dev flag.
    89             getBooleanProperty(DebugLogger.HPACK_NAME, false);
    89             getBooleanProperty(DebugLogger.HPACK_NAME, false);
    90     public static final boolean TESTING = DEBUG;
    90     public static final boolean TESTING = DEBUG;
    91 
    91 
       
    92     public static final boolean isHostnameVerificationDisabled = // enabled by default
       
    93         getBooleanProperty("jdk.internal.http.disableHostnameVerification", false);
       
    94 
    92     /**
    95     /**
    93      * Allocated buffer size. Must never be higher than 16K. But can be lower
    96      * Allocated buffer size. Must never be higher than 16K. But can be lower
    94      * if smaller allocation units preferred. HTTP/2 mandates that all
    97      * if smaller allocation units preferred. HTTP/2 mandates that all
    95      * implementations support frame payloads of at least 16K.
    98      * implementations support frame payloads of at least 16K.
    96      */
    99      */
   373     static String getNetProperty(String name) {
   376     static String getNetProperty(String name) {
   374         return AccessController.doPrivileged((PrivilegedAction<String>) () ->
   377         return AccessController.doPrivileged((PrivilegedAction<String>) () ->
   375                 NetProperties.get(name));
   378                 NetProperties.get(name));
   376     }
   379     }
   377 
   380 
   378     static boolean getBooleanProperty(String name, boolean def) {
   381     public static boolean getBooleanProperty(String name, boolean def) {
   379         return AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
   382         return AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
   380                 Boolean.parseBoolean(System.getProperty(name, String.valueOf(def))));
   383                 Boolean.parseBoolean(System.getProperty(name, String.valueOf(def))));
   381     }
   384     }
   382 
   385 
   383     public static SSLParameters copySSLParameters(SSLParameters p) {
   386     public static SSLParameters copySSLParameters(SSLParameters p) {
   793         if (session instanceof ExtendedSSLSession)
   796         if (session instanceof ExtendedSSLSession)
   794             return new ImmutableExtendedSSLSession((ExtendedSSLSession)session);
   797             return new ImmutableExtendedSSLSession((ExtendedSSLSession)session);
   795         else
   798         else
   796             return new ImmutableSSLSession(session);
   799             return new ImmutableSSLSession(session);
   797     }
   800     }
       
   801 
       
   802     /**
       
   803      * Enabled by default. May be disabled for testing. Use with care
       
   804      */
       
   805     public static boolean isHostnameVerificationDisabled() {
       
   806         return isHostnameVerificationDisabled;
       
   807     }
   798 }
   808 }