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

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

commit c1dce9b9c6765dea7aea8a60e3e952e4fe0f23bb
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 6779ea0e83..c61792b872 100644
--- a/java/org/apache/coyote/http2/Http2Parser.java
+++ b/java/org/apache/coyote/http2/Http2Parser.java
@@ -322,6 +322,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 ec996efd8e..3f7afab1df 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -122,6 +122,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