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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 40012414df Require an authority for HTTP/2 requests
40012414df is described below

commit 40012414df828a56126f76a7339669c7c919aae7
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 3140c0a4c9..bad1e40817 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -607,7 +607,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 83723aa648..ba01884cfb 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">


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

Reply via email to