]> granicus.if.org Git - apache/commitdiff
More merge fixes...
authorJim Jagielski <jim@apache.org>
Fri, 26 Aug 2011 16:58:34 +0000 (16:58 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 26 Aug 2011 16:58:34 +0000 (16:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1162165 13f79535-47bb-0310-9956-ffa450edef68

modules/http/byterange_filter.c

index a4564efcd526fbc46fbf88c0316d1ba3be46656e..84c4ed1ffe173b62560d953c55bac6b7cd8022c0 100644 (file)
@@ -548,22 +548,23 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
         }
         in_merge = 0;
         
-        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 !(iend-1 < 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 (in_merge) {
             overlaps++;
             continue;
@@ -574,6 +575,10 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
             idx = (indexes_t *)apr_array_push(indexes);
             idx->start = ostart;
             idx->end = oend;
+            /* new set again */
+            in_merge = 1;
+            ostart = start;
+            oend = end;
             num_ranges++;
         }
     }