From c82a5116c2f9e04b9c82f83a1ccb77e8d5935916 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Fri, 14 Dec 2012 12:54:50 +0000 Subject: [PATCH] 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 --- .../java/org/apache/http/impl/client/HttpClientBuilder.java | 4 ++-- .../org/apache/http/impl/client/SystemDefaultHttpClient.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java index 8c7c41ae4..9fc861b03 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/HttpClientBuilder.java @@ -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 { diff --git a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultHttpClient.java b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultHttpClient.java index 556a13bab..795c47676 100644 --- a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultHttpClient.java +++ b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultHttpClient.java @@ -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 {