From: Stefan Fritsch Date: Thu, 25 Aug 2011 23:00:08 +0000 (+0000) Subject: count ranges by simply counting commas X-Git-Tag: 2.3.15~348 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3a9879c5f30ec2651b9c8182f68a81ed5ea668ff;p=apache count ranges by simply counting commas git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1161790 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/byterange_filter.c b/modules/http/byterange_filter.c index 2ae1b44667..545a2c9c73 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -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; }