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

markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 583c74dcf3 Require an authority for HTTP/2 requests
583c74dcf3 is described below

commit 583c74dcf385c144bf71b1ac2b811ea577ac2dde
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 e4ac77bf99..2d412b318b 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -602,7 +602,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 63d1fbc287..9a1f213007 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -313,6 +313,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">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to