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 44012d4d47 Another fix for HTTP/2 5.1 test
44012d4d47 is described below

commit 44012d4d472abd1f142b9c1cc395863ae4f917cb
Author: Mark Thomas <[email protected]>
AuthorDate: Sat Nov 7 13:59:20 2026 +0000

    Another fix for HTTP/2 5.1 test
    
    Co-authored by: Claude / Sonnet 5.5
---
 java/org/apache/coyote/http2/Stream.java             | 5 +++++
 java/org/apache/coyote/http2/StreamProcessor.java    | 6 +++++-
 java/org/apache/coyote/http2/StreamStateMachine.java | 5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index b5dd957530..e28f7b1aee 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -1030,6 +1030,11 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
     }
 
 
+    boolean canReset() {
+        return state.canReset();
+    }
+
+
     StreamException getResetException() {
         return streamOutputBuffer.reset;
     }
diff --git a/java/org/apache/coyote/http2/StreamProcessor.java 
b/java/org/apache/coyote/http2/StreamProcessor.java
index 74e77cb140..0db06f283e 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -137,12 +137,16 @@ class StreamProcessor extends AbstractProcessor 
implements NonPipeliningProcesso
                             stream.close(ce);
                         } else if (!getErrorState().isIoAllowed()) {
                             StreamException se = stream.getResetException();
-                            if (se == null) {
+                            if (se == null && stream.canReset()) {
                                 se = new StreamException(
                                         
sm.getString("streamProcessor.error.stream", stream.getConnectionId(),
                                                 stream.getIdAsString()),
                                         Http2Error.INTERNAL_ERROR, 
stream.getIdAsInt());
                             }
+                            /*
+                             * If the stream is already closed (e.g. the 
client has already reset it), se will be null
+                             * and there is no need to send a reset in 
response. Still need to call close to perform the necessary clean-up.
+                             */
                             stream.close(se);
                         } else {
                             if (!stream.isActive()) {
diff --git a/java/org/apache/coyote/http2/StreamStateMachine.java 
b/java/org/apache/coyote/http2/StreamStateMachine.java
index f3f0f02d51..4af9b40c9a 100644
--- a/java/org/apache/coyote/http2/StreamStateMachine.java
+++ b/java/org/apache/coyote/http2/StreamStateMachine.java
@@ -136,6 +136,11 @@ class StreamStateMachine {
     }
 
 
+    final synchronized boolean canReset() {
+        return state.canReset();
+    }
+
+
     final synchronized boolean isActive() {
         return state.isActive();
     }


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

Reply via email to