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

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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 3d5776ddc7 Optimise the common case
3d5776ddc7 is described below

commit 3d5776ddc7fa0ab028cb23453737763dcd1f3495
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jun 22 13:19:13 2026 +0100

    Optimise the common case
---
 java/org/apache/catalina/servlets/DefaultServlet.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java 
b/java/org/apache/catalina/servlets/DefaultServlet.java
index 12a0e3a87f..e749820f10 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1391,6 +1391,11 @@ public class DefaultServlet extends HttpServlet {
             orderedRanges.add(adjustedRange);
         }
 
+        // Short-cut if two ranges or less (can't have more than 2 overlapping 
ranges)
+        if (ranges.getEntries().size() < 3) {
+            return true;
+        }
+
         int overlapCount = ranges.getEntries().size() - orderedRanges.size();
         // This only detected duplicate ranges. Each duplicate is equivalent 
to 1 overlap.
         // Off by one is deliberate. There is 1 more overlapping range than 
there are overlaps.


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

Reply via email to