This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 1e7e121cef Fix dropped HTTP/2 responses. 1e7e121cef is described below commit 1e7e121cefe6dae4ef03bc046b9575192ff13cc1 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 | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java index 5572e070c9..3afda9037b 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 378bbc5ac0..f7685e8a37 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -136,6 +136,12 @@ Add a parser for the <code>priority</code> HTTP header field defined in RFC 9218. (markt) </add> + <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> <subsection name="Other"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org