From ed7701c509af1fd4775d77a4c0eef1f4c63ac44d Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Sun, 11 Sep 2022 18:47:31 +0200 Subject: [PATCH] H2 async runtime to proactively set HTTP/2 protocol version in the execution context --- .../hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java index 6bad8d4e6..6120a69a4 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/InternalH2AsyncExecRuntime.java @@ -40,6 +40,7 @@ import org.apache.hc.core5.concurrent.Cancellable; import org.apache.hc.core5.concurrent.ComplexCancellable; import org.apache.hc.core5.concurrent.FutureCallback; import org.apache.hc.core5.http.HttpHost; +import org.apache.hc.core5.http.HttpVersion; import org.apache.hc.core5.http.nio.AsyncClientExchangeHandler; import org.apache.hc.core5.http.nio.AsyncPushConsumer; import org.apache.hc.core5.http.nio.HandlerFactory; @@ -101,6 +102,7 @@ class InternalH2AsyncExecRuntime implements AsyncExecRuntime { if (log.isDebugEnabled()) { log.debug("{} acquired endpoint", id); } + context.setProtocolVersion(HttpVersion.HTTP_2); callback.completed(InternalH2AsyncExecRuntime.this); }