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 c551ecaa1b Fix BZ 66842 - include DATA frames in overhead count with async c551ecaa1b is described below commit c551ecaa1ba4ffe50a67009a9c94efb03439ae8b Author: Mark Thomas <ma...@apache.org> AuthorDate: Sun Aug 6 12:44:07 2023 +0100 Fix BZ 66842 - include DATA frames in overhead count with async https://bz.apache.org/bugzilla/show_bug.cgi?id=66842 --- java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java | 3 +++ java/org/apache/coyote/http2/Http2UpgradeHandler.java | 2 +- webapps/docs/changelog.xml | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java index d9f69464f6..5c5c494357 100644 --- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java @@ -227,6 +227,9 @@ public class Http2AsyncUpgradeHandler extends Http2UpgradeHandler { log.debug(sm.getString("upgradeHandler.writeBody", connectionId, stream.getIdAsString(), Integer.toString(len), Boolean.valueOf(finished))); } + + reduceOverheadCount(FrameType.DATA); + // Need to check this now since sending end of stream will change this. boolean writable = stream.canWrite(); byte[] header = new byte[9]; diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java b/java/org/apache/coyote/http2/Http2UpgradeHandler.java index 4975e8f82d..d8e04d04da 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -1375,7 +1375,7 @@ class Http2UpgradeHandler extends AbstractStream implements InternalHttpUpgradeH } - private void reduceOverheadCount(FrameType frameType) { + void reduceOverheadCount(FrameType frameType) { // A non-overhead frame reduces the overhead count by // Http2Protocol.DEFAULT_OVERHEAD_REDUCTION_FACTOR. A simple browser // request is likely to have one non-overhead frame (HEADERS) and one diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b30faa3777..abb82adbaa 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -165,6 +165,11 @@ called after an error during asynchronous processing with HTTP/2. (markt) </fix> + <fix> + <bug>66842</bug>: When using asynchronous I/O (the default for NIO and + NIO2), include DATA frames when calculating the HTTP/2 overhead count to + ensure that connections are not prematurely terminated. (markt) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org