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 0864722  sendfile needs to check stream and connection flow control 
windows
0864722 is described below

commit 08647222518f97a519a7a65de10d69f64451c197
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jun 28 19:51:38 2021 +0100

    sendfile needs to check stream and connection flow control windows
---
 java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java |  2 +-
 webapps/docs/changelog.xml                                 | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java 
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index b465b45..13b6300 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -374,7 +374,7 @@ public class Http2AsyncUpgradeHandler extends 
Http2UpgradeHandler {
                 failed (e, sendfile);
                 return;
             }
-            int frameSize = Integer.min(getMaxFrameSize(), 
sendfile.streamReservation);
+            int frameSize = Integer.min(getMaxFrameSize(), 
Integer.min(sendfile.streamReservation, sendfile.connectionReservation));
             boolean finished = (frameSize == sendfile.left) && 
sendfile.stream.getCoyoteResponse().getTrailerFields() == null;
 
             // Need to check this now since sending end of stream will change 
this.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4fca383..5102b40 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,17 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.51 (remm)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        When writing an HTTP/2 response via sendfile (only enabled when
+        <code>useAsyncIO</code> is true) the connection flow control window was
+        sometimes ignored leading to various error conditions. sendfile now
+        checks both the stream and connection flow control windows before
+        writing. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>

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

Reply via email to