]> granicus.if.org Git - apache/commitdiff
Put 0- on the fast-track
authorJim Jagielski <jim@apache.org>
Mon, 26 Sep 2011 18:12:41 +0000 (18:12 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 26 Sep 2011 18:12:41 +0000 (18:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1175980 13f79535-47bb-0310-9956-ffa450edef68

modules/http/byterange_filter.c

index f796c8d1ff21a423461c97dfa82286c99af733c7..560043a363ced543d8a324a349a3d07156bd30be 100644 (file)
@@ -208,6 +208,20 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
             }
             else {                  /* "5-" */
                 end = clength - 1;
+                /*
+                 * special case: 0-
+                 *   ignore all other ranges provided
+                 *   return as a single range: 0-
+                 */
+                if (start == 0) {
+                    num_ranges = 0;
+                    sum_lengths = 0;
+                    in_merge = 1;
+                    oend = end;
+                    ostart = start;
+                    apr_array_clear(*indexes);
+                    break;
+                }
             }
         }
 
@@ -272,7 +286,7 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
         /* If all ranges are unsatisfiable, we should return 416 */
         return -1;
     }
-    if (sum_lengths >= clength) {
+    if (sum_lengths > clength) {
         ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
                       "Sum of ranges not smaller than file, ignoring.");
         return 0;