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

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


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

commit 1e025ea2ab4a6182c01fa258c9625600ded9a146
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 d6212eac2f..471b8c05e9 100644
--- a/java/org/apache/catalina/servlets/DefaultServlet.java
+++ b/java/org/apache/catalina/servlets/DefaultServlet.java
@@ -1638,6 +1638,11 @@ public class DefaultServlet extends HttpServlet {
             orderedRanges.add(currentRange);
         }
 
+        // Short-cut if two ranges or less (can't have more than 2 overlapping 
ranges)
+        if (ranges.getEntries().size() < 3) {
+            return result;
+        }
+
         // This only detected duplicate ranges. Each duplicate is equivalent 
to 1 overlap.
         int overlapCount = ranges.getEntries().size() - orderedRanges.size();
         // 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