This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 4d40eade08 Review "Report a content length of Integer.MAX_VALUE as an 
int"
4d40eade08 is described below

commit 4d40eade0849b69ded62ed61b3af1c4d9cd784bf
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 30 20:15:01 2026 +0000

    Review "Report a content length of Integer.MAX_VALUE as an int"
    
    Improve handling for content length above Integer.MAX_VALUE
---
 java/org/apache/catalina/connector/Response.java | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/connector/Response.java 
b/java/org/apache/catalina/connector/Response.java
index 9fb43e8291..a51194efc7 100644
--- a/java/org/apache/catalina/connector/Response.java
+++ b/java/org/apache/catalina/connector/Response.java
@@ -285,7 +285,7 @@ public class Response implements HttpServletResponse {
      */
     public boolean isAppCommitted() {
         return this.appCommitted || isCommitted() || isSuspended() ||
-                ((getContentLength() > 0) && (getContentWritten() >= 
getContentLength()));
+                ((getContentLengthLong() > 0) && (getContentWritten() >= 
getContentLengthLong()));
     }
 
 
@@ -456,6 +456,16 @@ public class Response implements HttpServletResponse {
     }
 
 
+    /**
+     * Get the content length that was set or calculated for this response as 
a long.
+     *
+     * @return the content length that was set or calculated for this response
+     */
+    public long getContentLengthLong() {
+        return getCoyoteResponse().getContentLengthLong();
+    }
+
+
     @Override
     public String getContentType() {
         return getCoyoteResponse().getContentType();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to