Skip to content

Commit

Permalink
Bug fix: allow Host headers in HTTP/2 request messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ok2c committed Oct 12, 2024
1 parent 7c59295 commit e95ce2c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public H2RequestConformance() {
HttpHeaders.KEEP_ALIVE,
HttpHeaders.PROXY_CONNECTION,
HttpHeaders.TRANSFER_ENCODING,
HttpHeaders.HOST,
HttpHeaders.UPGRADE,
HttpHeaders.TE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ void testH2RequestConformanceHostHeader() {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@

package org.apache.hc.core5.testing.compatibility.http2;

import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http2.impl.H2Processors;
import org.apache.hc.core5.http2.impl.nio.bootstrap.H2RequesterBootstrap;
import org.apache.hc.core5.http2.protocol.H2RequestConformance;
import org.apache.hc.core5.testing.compatibility.ContainerImages;
import org.junit.jupiter.api.AfterAll;
import org.testcontainers.containers.GenericContainer;
Expand All @@ -46,17 +43,6 @@ class ApacheHttpDCompatIT extends AbstractHttp2CompatIT {

@Override
void configure(final H2RequesterBootstrap bootstrap) {
bootstrap.setHttpProcessor(H2Processors.customClient(null)
.addFirst(new H2RequestConformance(
HttpHeaders.CONNECTION,
HttpHeaders.KEEP_ALIVE,
HttpHeaders.PROXY_CONNECTION,
HttpHeaders.TRANSFER_ENCODING,
// For some reason Apache HTTPD includes Host header in HTTP/2 promise messages
// though it should not
// HttpHeaders.HOST,
HttpHeaders.UPGRADE))
.build());
}

HttpHost targetHost() {
Expand Down

0 comments on commit e95ce2c

Please sign in to comment.