Skip to content

Commit 1ec5c38

Browse files
committed
Upgraded HttpCore to version 5.3.4
1 parent 10f7b78 commit 1ec5c38

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientBuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,8 @@ public CloseableHttpAsyncClient build() {
848848
HttpProcessorBuilder.create().build(),
849849
(request, context) -> pushConsumerRegistry.get(request),
850850
h2Config != null ? h2Config : H2Config.DEFAULT,
851-
charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT);
851+
charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT,
852+
ioReactorExceptionCallback != null ? ioReactorExceptionCallback : LoggingExceptionCallback.INSTANCE);
852853
final DefaultConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(
853854
ioEventHandlerFactory,
854855
ioReactorConfig != null ? ioReactorConfig : IOReactorConfig.DEFAULT,

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/H2AsyncClientProtocolStarter.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.io.IOException;
3131
import java.util.List;
3232

33+
import org.apache.hc.core5.function.Callback;
3334
import org.apache.hc.core5.http.Header;
3435
import org.apache.hc.core5.http.HttpConnection;
3536
import org.apache.hc.core5.http.config.CharCodingConfig;
@@ -60,16 +61,19 @@ class H2AsyncClientProtocolStarter implements IOEventHandlerFactory {
6061
private final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory;
6162
private final H2Config h2Config;
6263
private final CharCodingConfig charCodingConfig;
64+
private final Callback<Exception> exceptionCallback;
6365

6466
H2AsyncClientProtocolStarter(
6567
final HttpProcessor httpProcessor,
6668
final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory,
6769
final H2Config h2Config,
68-
final CharCodingConfig charCodingConfig) {
70+
final CharCodingConfig charCodingConfig,
71+
final Callback<Exception> exceptionCallback) {
6972
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
7073
this.exchangeHandlerFactory = exchangeHandlerFactory;
7174
this.h2Config = h2Config != null ? h2Config : H2Config.DEFAULT;
7275
this.charCodingConfig = charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT;
76+
this.exceptionCallback = exceptionCallback;
7377
}
7478

7579
@Override
@@ -163,15 +167,15 @@ public void onOutputFlowControl(final HttpConnection connection, final int strea
163167
}
164168

165169
});
166-
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false);
170+
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false, exceptionCallback);
167171
}
168172
final ClientH2StreamMultiplexerFactory http2StreamHandlerFactory = new ClientH2StreamMultiplexerFactory(
169173
httpProcessor,
170174
exchangeHandlerFactory,
171175
h2Config,
172176
charCodingConfig,
173177
null);
174-
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false);
178+
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false, exceptionCallback);
175179
}
176180

177181
}

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientBuilder.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,8 @@ public CloseableHttpAsyncClient build() {
10651065
h2Config != null ? h2Config : H2Config.DEFAULT,
10661066
h1Config != null ? h1Config : Http1Config.DEFAULT,
10671067
charCodingConfig != null ? charCodingConfig : CharCodingConfig.DEFAULT,
1068-
reuseStrategyCopy);
1068+
reuseStrategyCopy,
1069+
ioReactorExceptionCallback != null ? ioReactorExceptionCallback : LoggingExceptionCallback.INSTANCE);
10691070
final DefaultConnectingIOReactor ioReactor = new DefaultConnectingIOReactor(
10701071
ioEventHandlerFactory,
10711072
ioReactorConfig != null ? ioReactorConfig : IOReactorConfig.DEFAULT,

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClientProtocolNegotiationStarter.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import java.util.List;
3333

3434
import org.apache.hc.client5.http.impl.DefaultClientConnectionReuseStrategy;
35+
import org.apache.hc.core5.function.Callback;
3536
import org.apache.hc.core5.http.ConnectionReuseStrategy;
3637
import org.apache.hc.core5.http.Header;
3738
import org.apache.hc.core5.http.HttpConnection;
@@ -85,14 +86,16 @@ class HttpAsyncClientProtocolNegotiationStarter implements IOEventHandlerFactory
8586
private final ConnectionReuseStrategy http1ConnectionReuseStrategy;
8687
private final NHttpMessageParserFactory<HttpResponse> http1ResponseParserFactory;
8788
private final NHttpMessageWriterFactory<HttpRequest> http1RequestWriterFactory;
89+
private final Callback<Exception> exceptionCallback;
8890

8991
HttpAsyncClientProtocolNegotiationStarter(
9092
final HttpProcessor httpProcessor,
9193
final HandlerFactory<AsyncPushConsumer> exchangeHandlerFactory,
9294
final H2Config h2Config,
9395
final Http1Config h1Config,
9496
final CharCodingConfig charCodingConfig,
95-
final ConnectionReuseStrategy connectionReuseStrategy) {
97+
final ConnectionReuseStrategy connectionReuseStrategy,
98+
final Callback<Exception> exceptionCallback) {
9699
this.httpProcessor = Args.notNull(httpProcessor, "HTTP processor");
97100
this.exchangeHandlerFactory = exchangeHandlerFactory;
98101
this.h2Config = h2Config != null ? h2Config : H2Config.DEFAULT;
@@ -101,6 +104,7 @@ class HttpAsyncClientProtocolNegotiationStarter implements IOEventHandlerFactory
101104
this.http1ConnectionReuseStrategy = connectionReuseStrategy != null ? connectionReuseStrategy : DefaultClientConnectionReuseStrategy.INSTANCE;
102105
this.http1ResponseParserFactory = new DefaultHttpResponseParserFactory(h1Config);
103106
this.http1RequestWriterFactory = DefaultHttpRequestWriterFactory.INSTANCE;
107+
this.exceptionCallback = exceptionCallback;
104108
}
105109

106110
@Override
@@ -257,12 +261,12 @@ public void onOutputFlowControl(final HttpConnection connection, final int strea
257261
}
258262

259263
ioSession.registerProtocol(ApplicationProtocol.HTTP_1_1.id, new ClientHttp1UpgradeHandler(http1StreamHandlerFactory));
260-
ioSession.registerProtocol(ApplicationProtocol.HTTP_2.id, new ClientH2UpgradeHandler(http2StreamHandlerFactory));
264+
ioSession.registerProtocol(ApplicationProtocol.HTTP_2.id, new ClientH2UpgradeHandler(http2StreamHandlerFactory, exceptionCallback));
261265

262266
final HttpVersionPolicy versionPolicy = attachment instanceof HttpVersionPolicy ? (HttpVersionPolicy) attachment : HttpVersionPolicy.NEGOTIATE;
263267
switch (versionPolicy) {
264268
case FORCE_HTTP_2:
265-
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false);
269+
return new ClientH2PrefaceHandler(ioSession, http2StreamHandlerFactory, false, exceptionCallback);
266270
case FORCE_HTTP_1:
267271
return new ClientHttp1IOEventHandler(http1StreamHandlerFactory.create(ioSession));
268272
default:

httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/HttpAsyncClients.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ public static MinimalHttpAsyncClient createMinimal(
168168
h2Config,
169169
h1Config,
170170
CharCodingConfig.DEFAULT,
171-
DefaultClientConnectionReuseStrategy.INSTANCE),
171+
DefaultClientConnectionReuseStrategy.INSTANCE,
172+
LoggingExceptionCallback.INSTANCE),
172173
pushConsumerRegistry,
173174
ioReactorConfig,
174175
connmgr,
@@ -196,7 +197,8 @@ public static MinimalHttpAsyncClient createMinimal(
196197
h2Config,
197198
h1Config,
198199
CharCodingConfig.DEFAULT,
199-
DefaultClientConnectionReuseStrategy.INSTANCE),
200+
DefaultClientConnectionReuseStrategy.INSTANCE,
201+
LoggingExceptionCallback.INSTANCE),
200202
pushConsumerRegistry,
201203
ioReactorConfig,
202204
connmgr,
@@ -297,7 +299,8 @@ public static MinimalH2AsyncClient createHttp2Minimal(
297299
createMinimalProtocolProcessor(),
298300
(request, context) -> pushConsumerRegistry.get(request),
299301
h2Config,
300-
CharCodingConfig.DEFAULT),
302+
CharCodingConfig.DEFAULT,
303+
LoggingExceptionCallback.INSTANCE),
301304
pushConsumerRegistry,
302305
ioReactorConfig,
303306
dnsResolver,

pom.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@
6262
<properties>
6363
<maven.compiler.source>1.8</maven.compiler.source>
6464
<maven.compiler.target>1.8</maven.compiler.target>
65-
<httpcore.version>5.3.3</httpcore.version>
66-
<log4j.version>2.24.3</log4j.version>
65+
<httpcore.version>5.3.4</httpcore.version>
66+
<log4j.version>2.23.1</log4j.version>
6767
<brotli.version>0.1.2</brotli.version>
6868
<conscrypt.version>2.5.2</conscrypt.version>
6969
<ehcache.version>3.10.8</ehcache.version>
@@ -438,4 +438,4 @@
438438
</plugins>
439439
</reporting>
440440

441-
</project>
441+
</project>

0 commit comments

Comments
 (0)