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

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


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

commit b823e88da077f5fa973e34d72359bded9f621e3c
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 f739eeb6bd..b504a835b7 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -606,7 +606,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 fbd7bbc0b9..3927d3731f 100644
--- a/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
+++ b/test/org/apache/coyote/http2/TestHttp2Section_8_1.java
@@ -300,7 +300,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]"));
     }
 
 
@@ -324,7 +324,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 eee2f627c0..f7b09e8e40 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