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 2022/09/11 16:53:44 UTC

[httpcomponents-client] 01/02: H2 async runtime to proactively set HTTP/2 protocol version in the execution context

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git

commit ed7701c509af1fd4775d77a4c0eef1f4c63ac44d
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sun Sep 11 18:47:31 2022 +0200

    H2 async runtime to proactively set HTTP/2 protocol version in the execution context
---
 .../apache/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);
                         }