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

jbonofre pushed a commit to branch activemq-6.1.x
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/activemq-6.1.x by this push:
     new f43af81c65 AMQ-9716: Fix `maxMessageSize=-1` to correctly disable 
message size limit (#1441) (#1441)
f43af81c65 is described below

commit f43af81c65dd7327a1025df2626efca3eb335805
Author: Andrey Litvitski <andrey1010102...@gmail.com>
AuthorDate: Wed May 28 18:01:06 2025 +0300

    AMQ-9716: Fix `maxMessageSize=-1` to correctly disable message size limit 
(#1441) (#1441)
    
    (cherry picked from commit d226bfeb14fdc3efa1d33e35a95882435cc4a6c9)
---
 .../src/main/java/org/apache/activemq/web/MessageServletSupport.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java 
b/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
index 8f1a7e9869..2d982254f9 100644
--- 
a/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
+++ 
b/activemq-web/src/main/java/org/apache/activemq/web/MessageServletSupport.java
@@ -359,7 +359,7 @@ public abstract class MessageServletSupport extends 
HttpServlet {
         if (answer == null && contentType != null && contentLengthLong > -1l) {
             LOG.debug("Content-Type={} Content-Length={} maxMessageSize={}", 
contentType, contentLengthLong, maxMessageSize);
 
-            if (contentLengthLong > maxMessageSize) {
+            if (maxMessageSize != -1 && contentLengthLong > maxMessageSize) {
                 LOG.warn("Message body exceeds max allowed size. 
Content-Type={} Content-Length={} maxMessageSize={}", contentType, 
contentLengthLong, maxMessageSize);
                 throw new IOException("Message body exceeds max allowed size");
             }
@@ -400,6 +400,6 @@ public abstract class MessageServletSupport extends 
HttpServlet {
     }
 
     private boolean isMaxBodySizeExceeded(int totalRead, int expectedBodySize) 
{
-        return totalRead < 0 || totalRead >= Integer.MAX_VALUE || totalRead >= 
maxMessageSize || totalRead > expectedBodySize;
+        return totalRead < 0 || totalRead == Integer.MAX_VALUE || 
(maxMessageSize != -1 && totalRead >= maxMessageSize) || totalRead > 
expectedBodySize;
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@activemq.apache.org
For additional commands, e-mail: commits-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to