jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java
changeset 37593 824750ada3d6
parent 34943 52923a144ff6
child 37781 71ed5645f17c
equal deleted inserted replaced
37592:c80f098887f4 37593:824750ada3d6
    26 package sun.net.www.http;
    26 package sun.net.www.http;
    27 
    27 
    28 import java.io.*;
    28 import java.io.*;
    29 import java.net.*;
    29 import java.net.*;
    30 import java.util.Locale;
    30 import java.util.Locale;
       
    31 import java.util.Properties;
    31 import sun.net.NetworkClient;
    32 import sun.net.NetworkClient;
    32 import sun.net.ProgressSource;
    33 import sun.net.ProgressSource;
    33 import sun.net.www.MessageHeader;
    34 import sun.net.www.MessageHeader;
    34 import sun.net.www.HeaderParser;
    35 import sun.net.www.HeaderParser;
    35 import sun.net.www.MeteredStream;
    36 import sun.net.www.MeteredStream;
    36 import sun.net.www.ParseUtil;
    37 import sun.net.www.ParseUtil;
    37 import sun.net.www.protocol.http.HttpURLConnection;
    38 import sun.net.www.protocol.http.HttpURLConnection;
    38 import sun.util.logging.PlatformLogger;
    39 import sun.util.logging.PlatformLogger;
    39 import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*;
    40 import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*;
       
    41 import sun.security.action.GetPropertyAction;
    40 
    42 
    41 /**
    43 /**
    42  * @author Herb Jellinek
    44  * @author Herb Jellinek
    43  * @author Dave Brown
    45  * @author Dave Brown
    44  */
    46  */
   141     int getKeepAliveTimeout() {
   143     int getKeepAliveTimeout() {
   142         return keepAliveTimeout;
   144         return keepAliveTimeout;
   143     }
   145     }
   144 
   146 
   145     static {
   147     static {
   146         String keepAlive = java.security.AccessController.doPrivileged(
   148         Properties props = GetPropertyAction.getProperties();
   147             new sun.security.action.GetPropertyAction("http.keepAlive"));
   149         String keepAlive = props.getProperty("http.keepAlive");
   148 
   150         String retryPost = props.getProperty("sun.net.http.retryPost");
   149         String retryPost = java.security.AccessController.doPrivileged(
       
   150             new sun.security.action.GetPropertyAction("sun.net.http.retryPost"));
       
   151 
   151 
   152         if (keepAlive != null) {
   152         if (keepAlive != null) {
   153             keepAliveProp = Boolean.valueOf(keepAlive).booleanValue();
   153             keepAliveProp = Boolean.parseBoolean(keepAlive);
   154         } else {
   154         } else {
   155             keepAliveProp = true;
   155             keepAliveProp = true;
   156         }
   156         }
   157 
   157 
   158         if (retryPost != null) {
   158         if (retryPost != null) {
   159             retryPostProp = Boolean.valueOf(retryPost).booleanValue();
   159             retryPostProp = Boolean.parseBoolean(retryPost);
   160         } else
   160         } else
   161             retryPostProp = true;
   161             retryPostProp = true;
   162 
   162 
   163     }
   163     }
   164 
   164