You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/12/16 20:45:00 UTC

[tomcat] branch 9.0.x updated: Fix dropped HTTP/2 responses.

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 448d02cdb2 Fix dropped HTTP/2 responses.
448d02cdb2 is described below

commit 448d02cdb2b5a16127f3087e0bfeb9d1822c1367
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Dec 16 20:37:03 2022 +0000

    Fix dropped HTTP/2 responses.
    
    When resetting an HTTP/2 stream because the final response has been
    generated before the request has been fully read, use the HTTP/2 error
    code NO_ERROR so that client does not discard the response.
    
    Based on a suggestion by Lorenzo Dalla Vecchia.
---
 java/org/apache/coyote/http2/StreamProcessor.java |  2 +-
 test/org/apache/coyote/http2/TestFlowControl.java |  2 +-
 webapps/docs/changelog.xml                        | 10 ++++++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java
index 8582473521..cb946bff58 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -97,7 +97,7 @@ class StreamProcessor extends AbstractProcessor {
                             // send any more data on this stream (reset).
                             StreamException se = new StreamException(
                                     sm.getString("streamProcessor.cancel", stream.getConnectionId(),
-                                            stream.getIdAsString()), Http2Error.CANCEL, stream.getIdAsInt());
+                                            stream.getIdAsString()), Http2Error.NO_ERROR, stream.getIdAsInt());
                             stream.close(se);
                         } else if (!getErrorState().isConnectionIoAllowed()) {
                             ConnectionException ce = new ConnectionException(sm.getString(
diff --git a/test/org/apache/coyote/http2/TestFlowControl.java b/test/org/apache/coyote/http2/TestFlowControl.java
index 60269389e1..8d45ce86d7 100644
--- a/test/org/apache/coyote/http2/TestFlowControl.java
+++ b/test/org/apache/coyote/http2/TestFlowControl.java
@@ -109,7 +109,7 @@ public class TestFlowControl extends Http2TestBase {
                     "3-HeadersEnd\n" +
                     "3-Body-" + contentLength + "\n" +
                     "3-EndOfStream\n" +
-                    "3-RST-[8]\n", output.getTrace());
+                    "3-RST-[0]\n", output.getTrace());
             output.clearTrace();
 
             // Write 3*16k=48k of request body
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e5b523842d..ab3f798683 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -115,6 +115,16 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        When resetting an HTTP/2 stream because the final response has been
+        generated before the request has been fully read, use the HTTP/2 error
+        code <code>NO_ERROR</code> so that client does not discard the response.
+        Based on a suggestion by Lorenzo Dalla Vecchia. (markt)
+      </fix>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 9.0.70 (remm)" rtext="2022-12-05">
   <subsection name="Catalina">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org