Skip to content

Commit d157f9a

Browse files
authored
Merge pull request #773 from commercetools/upgrade_httpasyncclient
Update Apache AsyncHttpClient
2 parents 54fba54 + 1d8f3f6 commit d157f9a

File tree

6 files changed

+29
-41
lines changed

6 files changed

+29
-41
lines changed

commercetools/commercetools-apachehttp-client/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
dependencies {
33
api project(":rmf:rmf-java-base")
4-
api "org.apache.httpcomponents.client5:httpclient5:5.3.1" version {
5-
strictly "[5.0,6.0["
6-
prefer "5.1.3"
4+
api "org.apache.httpcomponents.client5:httpclient5:5.4.1" version {
5+
strictly "[5.4.1,6.0["
6+
prefer "5.4.1"
77
}
88

99
api commons.io version commons.io_version
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
package com.commercetools.http.apachehttp;
3+
4+
import org.apache.hc.client5.http.classic.HttpClient;
5+
import org.apache.hc.core5.util.VersionInfo;
6+
7+
public class ApacheHttpClientSolutionInfo extends io.vrap.rmf.base.client.SolutionInfo {
8+
public ApacheHttpClientSolutionInfo() {
9+
setName("ApacheHttpAsyncClient");
10+
setVersion(
11+
VersionInfo.loadVersionInfo("org.apache.hc.client5", HttpClient.class.getClassLoader()).getRelease());
12+
}
13+
}

commercetools/commercetools-apachehttp-client/src/main/java/com/commercetools/http/apachehttp/CtApacheHttpClient.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.apache.hc.client5.http.async.methods.SimpleBody;
2020
import org.apache.hc.client5.http.async.methods.SimpleHttpResponse;
2121
import org.apache.hc.client5.http.async.methods.SimpleResponseConsumer;
22+
import org.apache.hc.client5.http.config.TlsConfig;
2223
import org.apache.hc.client5.http.impl.async.CloseableHttpAsyncClient;
2324
import org.apache.hc.client5.http.impl.async.HttpAsyncClientBuilder;
2425
import org.apache.hc.client5.http.impl.nio.PoolingAsyncClientConnectionManagerBuilder;
@@ -32,7 +33,6 @@
3233
import org.apache.hc.core5.http.nio.support.AsyncRequestBuilder;
3334
import org.apache.hc.core5.http2.HttpVersionPolicy;
3435
import org.apache.hc.core5.reactor.IOReactorStatus;
35-
import org.apache.hc.core5.reactor.ssl.TlsDetails;
3636

3737
public class CtApacheHttpClient extends HttpClientBase {
3838
public static final int MAX_REQUESTS = 64;
@@ -46,19 +46,19 @@ public static HttpAsyncClientBuilder createClientBuilder() {
4646
}
4747

4848
public static HttpAsyncClientBuilder createClientBuilder(AsyncClientConnectionManager cm) {
49-
return HttpAsyncClientBuilder.create().setVersionPolicy(HttpVersionPolicy.NEGOTIATE).setConnectionManager(cm);
49+
return HttpAsyncClientBuilder.create().setConnectionManager(cm);
5050
}
5151

5252
public static PoolingAsyncClientConnectionManagerBuilder createConnectionManager(final int maxConnTotal,
5353
final int maxConnPerRoute) {
54-
final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create()
55-
.useSystemProperties()
56-
.setTlsDetailsFactory(
57-
sslEngine -> new TlsDetails(sslEngine.getSession(), sslEngine.getApplicationProtocol()))
54+
final TlsStrategy tlsStrategy = ClientTlsStrategyBuilder.create().useSystemProperties().build();
55+
final TlsConfig tlsConfig = TlsConfig.copy(TlsConfig.DEFAULT)
56+
.setVersionPolicy(HttpVersionPolicy.NEGOTIATE)
5857
.build();
5958
return PoolingAsyncClientConnectionManagerBuilder.create()
6059
.setMaxConnPerRoute(maxConnPerRoute)
6160
.setMaxConnTotal(maxConnTotal)
61+
.setDefaultTlsConfig(tlsConfig)
6262
.setTlsStrategy(tlsStrategy);
6363
}
6464

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.commercetools.http.apachehttp.ApacheHttpClientSolutionInfo

licenses/commercetools-apachehttp-client/index.json

+3-16
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@
7878
}
7979
]
8080
},
81-
{
82-
"moduleName": "commons-codec:commons-codec",
83-
"moduleVersion": "1.15",
84-
"moduleUrls": [
85-
"https://commons.apache.org/proper/commons-codec/"
86-
],
87-
"moduleLicenses": [
88-
{
89-
"moduleLicense": "Apache License, Version 2.0",
90-
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
91-
}
92-
]
93-
},
9481
{
9582
"moduleName": "commons-io:commons-io",
9683
"moduleVersion": "2.11.0",
@@ -155,7 +142,7 @@
155142
},
156143
{
157144
"moduleName": "org.apache.httpcomponents.client5:httpclient5",
158-
"moduleVersion": "5.1.3",
145+
"moduleVersion": "5.4.1",
159146
"moduleLicenses": [
160147
{
161148
"moduleLicense": "Apache License, Version 2.0",
@@ -165,7 +152,7 @@
165152
},
166153
{
167154
"moduleName": "org.apache.httpcomponents.core5:httpcore5",
168-
"moduleVersion": "5.1.3",
155+
"moduleVersion": "5.3.1",
169156
"moduleLicenses": [
170157
{
171158
"moduleLicense": "Apache License, Version 2.0",
@@ -175,7 +162,7 @@
175162
},
176163
{
177164
"moduleName": "org.apache.httpcomponents.core5:httpcore5-h2",
178-
"moduleVersion": "5.1.3",
165+
"moduleVersion": "5.3.1",
179166
"moduleLicenses": [
180167
{
181168
"moduleLicense": "Apache License, Version 2.0",

licenses/index.json

+3-16
Original file line numberDiff line numberDiff line change
@@ -563,19 +563,6 @@
563563
}
564564
]
565565
},
566-
{
567-
"moduleName": "commons-codec:commons-codec",
568-
"moduleVersion": "1.15",
569-
"moduleUrls": [
570-
"https://commons.apache.org/proper/commons-codec/"
571-
],
572-
"moduleLicenses": [
573-
{
574-
"moduleLicense": "Apache License, Version 2.0",
575-
"moduleLicenseUrl": "https://www.apache.org/licenses/LICENSE-2.0"
576-
}
577-
]
578-
},
579566
{
580567
"moduleName": "commons-io:commons-io",
581568
"moduleVersion": "2.11.0",
@@ -1220,7 +1207,7 @@
12201207
},
12211208
{
12221209
"moduleName": "org.apache.httpcomponents.client5:httpclient5",
1223-
"moduleVersion": "5.1.3",
1210+
"moduleVersion": "5.4.1",
12241211
"moduleLicenses": [
12251212
{
12261213
"moduleLicense": "Apache License, Version 2.0",
@@ -1230,7 +1217,7 @@
12301217
},
12311218
{
12321219
"moduleName": "org.apache.httpcomponents.core5:httpcore5",
1233-
"moduleVersion": "5.1.3",
1220+
"moduleVersion": "5.3.1",
12341221
"moduleLicenses": [
12351222
{
12361223
"moduleLicense": "Apache License, Version 2.0",
@@ -1240,7 +1227,7 @@
12401227
},
12411228
{
12421229
"moduleName": "org.apache.httpcomponents.core5:httpcore5-h2",
1243-
"moduleVersion": "5.1.3",
1230+
"moduleVersion": "5.3.1",
12441231
"moduleLicenses": [
12451232
{
12461233
"moduleLicense": "Apache License, Version 2.0",

0 commit comments

Comments
 (0)