You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2024/01/08 13:25:13 UTC
(httpcomponents-client) 01/01: HTTPCLIENT-2315: client builders fails to apply system properties to the default connection manager
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch HTTPCLIENT-2315
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 7b12669bd6f70d3534179e8f581ceffdbdbe6b1a
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Mon Jan 8 14:24:36 2024 +0100
HTTPCLIENT-2315: client builders fails to apply system properties to the default connection manager
---
.../apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java | 6 +++++-
.../org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
index 673dbbf09..2d2702b8a 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java
@@ -779,7 +779,11 @@ public class HttpAsyncClientBuilder {
public CloseableHttpAsyncClient build() {
AsyncClientConnectionManager connManagerCopy = this.connManager;
if (connManagerCopy == null) {
- connManagerCopy = PoolingAsyncClientConnectionManagerBuilder.create().build();
+ final PoolingAsyncClientConnectionManagerBuilder connectionManagerBuilder = PoolingAsyncClientConnectionManagerBuilder.create();
+ if (systemProperties) {
+ connectionManagerBuilder.useSystemProperties();
+ }
+ connManagerCopy = connectionManagerBuilder.build();
}
ConnectionKeepAliveStrategy keepAliveStrategyCopy = this.keepAliveStrategy;
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
index 0999f9d28..c5cf79ad7 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/classic/HttpClientBuilder.java
@@ -751,7 +751,11 @@ public class HttpClientBuilder {
}
HttpClientConnectionManager connManagerCopy = this.connManager;
if (connManagerCopy == null) {
- connManagerCopy = PoolingHttpClientConnectionManagerBuilder.create().build();
+ final PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder = PoolingHttpClientConnectionManagerBuilder.create();
+ if (systemProperties) {
+ connectionManagerBuilder.useSystemProperties();
+ }
+ connManagerCopy = connectionManagerBuilder.build();
}
ConnectionReuseStrategy reuseStrategyCopy = this.reuseStrategy;
if (reuseStrategyCopy == null) {