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 7bd8533232 fix Bug 66084 Correctly calculate bytes written
7bd8533232 is described below

commit 7bd85332320ba23fdcbbb8173e361e7c95baa4b7
Author: lihan <aooo...@gmail.com>
AuthorDate: Tue May 24 11:20:44 2022 +0800

    fix Bug 66084 Correctly calculate bytes written
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=66084
---
 java/org/apache/catalina/connector/OutputBuffer.java | 3 ++-
 webapps/docs/changelog.xml                           | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/connector/OutputBuffer.java 
b/java/org/apache/catalina/connector/OutputBuffer.java
index 8f7d90d956..ac55957734 100644
--- a/java/org/apache/catalina/connector/OutputBuffer.java
+++ b/java/org/apache/catalina/connector/OutputBuffer.java
@@ -403,8 +403,9 @@ public class OutputBuffer extends Writer {
             return;
         }
 
+        int remaining = from.remaining();
         append(from);
-        bytesWritten += from.remaining();
+        bytesWritten += remaining;
 
         // if called from within flush(), then immediately flush
         // remaining bytes
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 24c8a20c36..504a56ad06 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -133,6 +133,10 @@
         connector, ensure that flushing the buffers attempts to empty all of 
the
         output buffers. (markt)
       </fix>
+      <fix>
+        <bug>66084</bug>: Correctly calculate bytes written to a response. Pull
+        request <pr>516</pr> provided by aooohan HanLi. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to