]> granicus.if.org Git - apache/blobdiff - modules/http/byterange_filter.c
Turn some APR_BUCKET_REMOVE(e)+apr_bucket_destroy(e) into the equivalent apr_bucket_d...
[apache] / modules / http / byterange_filter.c
index 7aa3215c0cd8eecdca9f185ba72a49007d3ef00b..cc11140ada6d4947c88628b03d2a48b05c72f10c 100644 (file)
@@ -82,8 +82,6 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
                             int *overlaps, int *reversals)
 {
     const char *range;
-    const char *if_range;
-    const char *match;
     const char *ct;
     char *cur;
     apr_array_header_t *merged;
@@ -120,20 +118,9 @@ static int ap_set_byterange(request_rec *r, apr_off_t clength,
 
     /*
      * Check the If-Range header for Etag or Date.
-     * Note that this check will return false (as required) if either
-     * of the two etags are weak.
      */
-    if ((if_range = apr_table_get(r->headers_in, "If-Range"))) {
-        if (if_range[0] == '"') {
-            if (!(match = apr_table_get(r->headers_out, "Etag"))
-                || (strcmp(if_range, match) != 0)) {
-                return 0;
-            }
-        }
-        else if (!(match = apr_table_get(r->headers_out, "Last-Modified"))
-                 || (strcmp(if_range, match) != 0)) {
-            return 0;
-        }
+    if (AP_CONDITION_NOMATCH == ap_condition_if_range(r, r->headers_out)) {
+        return 0;
     }
 
     range += 6;
@@ -363,8 +350,7 @@ static apr_status_t copy_brigade_range(apr_bucket_brigade *bb,
                     return rv;
                 }
                 out_first = APR_BUCKET_NEXT(copy);
-                APR_BUCKET_REMOVE(copy);
-                apr_bucket_destroy(copy);
+                apr_bucket_delete(copy);
             }
             else {
                 out_first = copy;
@@ -383,8 +369,7 @@ static apr_status_t copy_brigade_range(apr_bucket_brigade *bb,
                 }
                 copy = APR_BUCKET_NEXT(copy);
                 if (copy != APR_BRIGADE_SENTINEL(bbout)) {
-                    APR_BUCKET_REMOVE(copy);
-                    apr_bucket_destroy(copy);
+                    apr_bucket_delete(copy);
                 }
             }
             break;