]> granicus.if.org Git - apache/commitdiff
merge some more adjacent ranges such as a-n,n+1-b, and
authorEric Covener <covener@apache.org>
Sat, 27 Aug 2011 20:37:58 +0000 (20:37 +0000)
committerEric Covener <covener@apache.org>
Sat, 27 Aug 2011 20:37:58 +0000 (20:37 +0000)
refactor/reduce the tests on the start/end positions.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1162440 13f79535-47bb-0310-9956-ffa450edef68

modules/http/byterange_filter.c

index 046aa51d779920244dc7bf8a50de90a09d440a83..a1cbd9c6db9f30c4a806ce44c1c05003bcbfe634 100644 (file)
@@ -531,24 +531,21 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
             continue;
         }
         in_merge = 0;
+      
+        if (start >= ostart && end <= oend) { 
+            in_merge = 1;
+        } 
 
-        if (!(end <= ostart || start-1 >= oend)) {
-            if (start < ostart) {
-                ostart = start;
-                reversals++;
-                in_merge = 1;
-            }
-            else if (start < oend || start == ostart) {
-                in_merge = 1;
-            }
-            if (end >= oend && (start-1) <= oend) {
-                oend = end;
-                in_merge = 1;
-            }
-            else if (end > ostart && end <= oend) {
-                in_merge = 1;
-            }
+        if (start < ostart && end >= ostart-1) {
+            ostart = start;
+            reversals++;
+            in_merge = 1;
         }
+        if (end >= oend && start <= oend+1 ) {
+            oend = end;
+            in_merge = 1;
+        }
+
         if (in_merge) {
             overlaps++;
             continue;