(tomcat) branch 11.0.x updated: Require an authority for HTTP/2 requests
[email protected] Wed, 22 Jul 2026 15:48:29 +0000
| Newsgroups | gmane.comp.jakarta.tomcat.devel |
|---|---|
| Message-ID | <178473530939.185418.17856966785516577065@gitbox3-he-fi.apache.org> |
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 8639b20f04 Require an authority for HTTP/2 requests
8639b20f04 is described below
commit 8639b20f045c88f356b887204f52e897399f0de7
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jul 22 16:48:09 2026 +0100
Require an authority for HTTP/2 requests
---
java/org/apache/coyote/http2/Stream.java | 3 ++-
test/org/apache/coyote/http2/TestHttp2Section_8_1.java | 4 ++--
webapps/docs/changelog.xml | 5 +++++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/java/org/apache/coyote/http2/Stream.java b/java/org/apache/coyote/http2/Stream.java
index b5de81f69d..b3f1453980 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -601,7 +601,8 @@ class Stream extends AbstractNonZeroStream implements HeaderEmitter {
}
} else {
// All other methods
- if (coyoteRequest.scheme().isNull() || coyoteRequest.requestURI().isNull()) {
+ if (coyoteRequest.scheme().isNull() || coyoteRequest.requestURI().isNull() ||
+ coyoteRequest.serverName().isNull()) {
missingHeader = true;
}
}
diff --git a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
index 6533e86c3b..55cda91103 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
@@ -301,7 +301,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
parser.readFrame();
String trace = output.getTrace();
- Assert.assertTrue(trace, trace.contains("3-Header-[:status]-[400]"));
+ Assert.assertTrue(trace, trace.contains("3-RST-[1]"));
}
@@ -325,7 +325,7 @@ public class TestHttp2Section_8_1 extends Http2TestBase {
parser.readFrame();
String trace = output.getTrace();
- Assert.assertTrue(trace, trace.contains("3-Header-[:status]-[400]"));
+ Assert.assertTrue(trace, trace.contains("3-RST-[1]"));
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 64e75beebe..9bd90c86c9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -164,6 +164,11 @@
When processing an HTTP upgrade from HTTP/1.1 to HTTP/2, ensure that all
the HTTP/1.1 data has been processed before switching protocols. (markt)
</fix>
+ <fix>
+ Require every HTTP/2 request to provide an authority (either an
+ <code>:authority</code> pseudo header or a <code>Host</code> header).
+ (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">