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

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit fa5dca44b0a06dc01f6b88ec9ac5a7c47faa0a56
Author: opencode <[email protected]>
AuthorDate: Tue Sep 29 19:09:16 2026 +0200

    Avoid buffering remote WAR uploads of unknown length in memory in the 
Manager Ant tasks
---
 java/org/apache/catalina/ant/AbstractCatalinaTask.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/java/org/apache/catalina/ant/AbstractCatalinaTask.java 
b/java/org/apache/catalina/ant/AbstractCatalinaTask.java
index 664c6f9843..96b35ed4e9 100644
--- a/java/org/apache/catalina/ant/AbstractCatalinaTask.java
+++ b/java/org/apache/catalina/ant/AbstractCatalinaTask.java
@@ -272,6 +272,11 @@ public abstract class AbstractCatalinaTask extends 
BaseRedirectorHelperTask {
                     hconn.setRequestProperty("Content-Length", "" + 
contentLength);
 
                     hconn.setFixedLengthStreamingMode(contentLength);
+                } else {
+                    // The length is unknown. Use chunked streaming to avoid 
the
+                    // default HttpURLConnection behaviour of buffering the
+                    // entire request body in memory.
+                    hconn.setChunkedStreamingMode(0);
                 }
             } else {
                 hconn.setDoOutput(false);


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

Reply via email to