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

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


The following commit(s) were added to refs/heads/main by this push:
     new fd019fdf7f Optimise the common case
fd019fdf7f is described below

commit fd019fdf7f8b78f3dd299537208ecd2d19b2ac44
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 96fb564c06..0d8a1b1f8e 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1376,6 +1376,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