Make sure 'http.keepAlive' defaults to true

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1421835 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2012-12-14 12:54:50 +00:00
parent 1779158a4f
commit c82a5116c2
2 changed files with 4 additions and 4 deletions

View File

@ -459,7 +459,7 @@ public class HttpClientBuilder {
poolingmgr.setDefaultConnectionConfig(defaultConnectionConfig);
}
if (systemProperties) {
String s = System.getProperty("http.keepAlive");
String s = System.getProperty("http.keepAlive", "true");
if ("true".equalsIgnoreCase(s)) {
s = System.getProperty("http.maxConnections", "5");
int max = Integer.parseInt(s);
@ -479,7 +479,7 @@ public class HttpClientBuilder {
ConnectionReuseStrategy reuseStrategy = this.reuseStrategy;
if (reuseStrategy == null) {
if (systemProperties) {
String s = System.getProperty("http.keepAlive");
String s = System.getProperty("http.keepAlive", "true");
if ("true".equalsIgnoreCase(s)) {
reuseStrategy = DefaultConnectionReuseStrategy.INSTANCE;
} else {

View File

@ -120,7 +120,7 @@ public class SystemDefaultHttpClient extends DefaultHttpClient {
protected ClientConnectionManager createClientConnectionManager() {
PoolingClientConnectionManager connmgr = new PoolingClientConnectionManager(
SchemeRegistryFactory.createSystemDefault());
String s = System.getProperty("http.keepAlive");
String s = System.getProperty("http.keepAlive", "true");
if ("true".equalsIgnoreCase(s)) {
s = System.getProperty("http.maxConnections", "5");
int max = Integer.parseInt(s);
@ -138,7 +138,7 @@ public class SystemDefaultHttpClient extends DefaultHttpClient {
@Override
protected ConnectionReuseStrategy createConnectionReuseStrategy() {
String s = System.getProperty("http.keepAlive");
String s = System.getProperty("http.keepAlive", "true");
if ("true".equalsIgnoreCase(s)) {
return new DefaultConnectionReuseStrategy();
} else {