]> granicus.if.org Git - apache/commitdiff
count ranges by simply counting commas
authorStefan Fritsch <sf@apache.org>
Thu, 25 Aug 2011 23:00:08 +0000 (23:00 +0000)
committerStefan Fritsch <sf@apache.org>
Thu, 25 Aug 2011 23:00:08 +0000 (23:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1161790 13f79535-47bb-0310-9956-ffa450edef68

modules/http/byterange_filter.c

index 2ae1b44667b710dbeeeafacf93e24aef8da3330b..545a2c9c73672a7d6cf79f1fc9cea3c6ebbbf03d 100644 (file)
@@ -468,7 +468,7 @@ static int ap_set_byterange(request_rec *r)
     const char *if_range;
     const char *match;
     const char *ct;
-    int num_ranges;
+    int num_ranges = 1;
 
     if (r->assbackwards) {
         return 0;
@@ -521,17 +521,14 @@ static int ap_set_byterange(request_rec *r)
         }
     }
 
-    if (!ap_strchr_c(range, ',')) {
-        /* a single range */
-        num_ranges = 1;
-    }
-    else {
-        /* a multiple range */
-        num_ranges = 2;
-    }
-
+    range += 6;
     r->status = HTTP_PARTIAL_CONTENT;
-    r->range = range + 6;
+    r->range = range;
+    while (*range) {
+        if (*range == ',')
+            num_ranges++;
+        range++;
+    }
 
     return num_ranges;
 }