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 ca9f5c51c6 Fix BZ 66842 - include DATA frames in overhead count with async ca9f5c51c6 is described below commit ca9f5c51c63f87a5901f8be254d86342c944571b 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 0a0868d477..d551bbc6ab 100644 --- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java @@ -228,6 +228,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 e648d4dace..8b6c53bad5 100644 --- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java +++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java @@ -1381,7 +1381,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 993af03a15..7491ef84c1 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), 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