You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/08/26 01:00:08 UTC

svn commit: r1161790 - /httpd/httpd/trunk/modules/http/byterange_filter.c

Author: sf
Date: Thu Aug 25 23:00:08 2011
New Revision: 1161790

URL: http://svn.apache.org/viewvc?rev=1161790&view=rev
Log:
count ranges by simply counting commas

Modified:
    httpd/httpd/trunk/modules/http/byterange_filter.c

Modified: httpd/httpd/trunk/modules/http/byterange_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/byterange_filter.c?rev=1161790&r1=1161789&r2=1161790&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http/byterange_filter.c (original)
+++ httpd/httpd/trunk/modules/http/byterange_filter.c Thu Aug 25 23:00:08 2011
@@ -468,7 +468,7 @@ static int ap_set_byterange(request_rec 
     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 
         }
     }
 
-    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;
 }