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 2024/10/12 13:37:47 UTC

(httpcomponents-core) 01/01: Bug fix: allow `Host` headers in HTTP/2 request messages

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

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

commit 8bdf8ce0e4521268d0e9cada1376162a2ddeec21
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Sat Oct 12 15:22:39 2024 +0200

    Bug fix: allow `Host` headers in HTTP/2 request messages
---
 .../java/org/apache/hc/core5/http2/protocol/H2RequestConformance.java | 1 -
 .../java/org/apache/hc/core5/http2/protocol/TestH2Interceptors.java   | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/protocol/H2RequestConformance.java b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/protocol/H2RequestConformance.java
index a2d010b14..ef528fbc2 100644
--- a/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/protocol/H2RequestConformance.java
+++ b/httpcore5-h2/src/main/java/org/apache/hc/core5/http2/protocol/H2RequestConformance.java
@@ -67,7 +67,6 @@ public class H2RequestConformance implements HttpRequestInterceptor {
                 HttpHeaders.KEEP_ALIVE,
                 HttpHeaders.PROXY_CONNECTION,
                 HttpHeaders.TRANSFER_ENCODING,
-                HttpHeaders.HOST,
                 HttpHeaders.UPGRADE,
                 HttpHeaders.TE);
     }
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/protocol/TestH2Interceptors.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/protocol/TestH2Interceptors.java
index ef2e84aaa..38410c787 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/protocol/TestH2Interceptors.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/protocol/TestH2Interceptors.java
@@ -194,8 +194,8 @@ class TestH2Interceptors {
         request.addHeader("Host", "host");
 
         final H2RequestConformance interceptor = new H2RequestConformance();
-        Assertions.assertThrows(HttpException.class, () -> interceptor.process(request, null, context),
-                "Header 'Host: host' is illegal for HTTP/2 messages");
+        Assertions.assertDoesNotThrow(() -> interceptor.process(request, null, context),
+                "Header 'Host: host' is permissible for HTTP/2 messages");
     }
 
     @Test