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

markt 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 47295afbb4 Reset the HTTP/2 request header read buffer after a stream 
reset
47295afbb4 is described below

commit 47295afbb4848c1c6fc883df855614a61d958435
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Mar 23 16:08:33 2026 +0000

    Reset the HTTP/2 request header read buffer after a stream reset
---
 java/org/apache/coyote/http2/Http2Parser.java | 6 ++++++
 webapps/docs/changelog.xml                    | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/java/org/apache/coyote/http2/Http2Parser.java 
b/java/org/apache/coyote/http2/Http2Parser.java
index e5b59d8d92..5cb340efe1 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -305,6 +305,12 @@ class Http2Parser {
         long errorCode = ByteUtil.getFourBytes(payload, 0);
         output.reset(streamId, errorCode);
         headersCurrentStream = -1;
+        if (headerReadBuffer.capacity() > 
Constants.DEFAULT_HEADER_READ_BUFFER_SIZE) {
+            // Reset size for new request if the buffer was previously expanded
+            headerReadBuffer = 
ByteBuffer.allocate(Constants.DEFAULT_HEADER_READ_BUFFER_SIZE);
+        } else {
+            headerReadBuffer.clear();
+        }
         headersEndStream = false;
     }
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7d691493a4..011aee9be6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -118,6 +118,10 @@
         connection is closed. Pull request <pr>966</pr> provided by Phil Clay.
         (markt)
       </fix>
+      <fix>
+        Ensure the HTTP/2 request header read buffer is reset (including
+        restoration to default size) after a stream reset. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


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

Reply via email to