Skip to content

Commit 2f87e4a

Browse files
committed
Regression: async execution runtimes set the negotiated protocol version in the execution context at the wrong point of request execution
1 parent 9cde791 commit 2f87e4a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public void completed(final IOSession ioSession) {
102102
if (log.isDebugEnabled()) {
103103
log.debug("{} acquired endpoint", id);
104104
}
105-
context.setProtocolVersion(HttpVersion.HTTP_2);
106105
callback.completed(InternalH2AsyncExecRuntime.this);
107106
}
108107

@@ -237,6 +236,7 @@ public Cancellable execute(
237236
if (log.isDebugEnabled()) {
238237
log.debug("{} start execution {}", ConnPoolSupport.getId(endpoint), id);
239238
}
239+
context.setProtocolVersion(HttpVersion.HTTP_2);
240240
session.enqueue(
241241
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context),
242242
Command.Priority.NORMAL);
@@ -254,6 +254,7 @@ public void completed(final IOSession ioSession) {
254254
if (log.isDebugEnabled()) {
255255
log.debug("{} start execution {}", ConnPoolSupport.getId(endpoint), id);
256256
}
257+
context.setProtocolVersion(HttpVersion.HTTP_2);
257258
session.enqueue(
258259
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, complexCancellable, context),
259260
Command.Priority.NORMAL);

httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,6 @@ public void completed(final ManagedAsyncClientConnection connection) {
465465
LOG.debug("{} connected {}", ConnPoolSupport.getId(endpoint), ConnPoolSupport.getId(connection));
466466
}
467467
final ProtocolVersion protocolVersion = connection.getProtocolVersion();
468-
context.setProtocolVersion(protocolVersion);
469468
final Timeout socketTimeout = connectionConfig.getSocketTimeout();
470469
if (socketTimeout != null) {
471470
connection.setSocketTimeout(socketTimeout);
@@ -521,7 +520,6 @@ public void completed(final ManagedAsyncClientConnection connection) {
521520

522521
@Override
523522
public void completed(final ProtocolIOSession protocolIOSession) {
524-
context.setProtocolVersion(HttpVersion.HTTP_2);
525523
if (callback != null) {
526524
callback.completed(endpoint);
527525
}
@@ -750,6 +748,7 @@ public void execute(
750748
if (LOG.isDebugEnabled()) {
751749
LOG.debug("{} executing exchange {} over {}", id, exchangeId, ConnPoolSupport.getId(connection));
752750
}
751+
context.setProtocolVersion(connection.getProtocolVersion());
753752
connection.submitCommand(
754753
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, context),
755754
Command.Priority.NORMAL);

0 commit comments

Comments
 (0)