Commit c180fcb7 authored by Ruediger Pluem's avatar Ruediger Pluem
Browse files

* If possible, check if the size of an object to cache is within the

  configured boundaries before actually saving data.

Submitted by: Niklas Edmundsson <nikke acc.umu.se>
Reviewed by: rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@411469 13f79535-47bb-0310-9956-ffa450edef68
parent f48e5e23
Loading
Loading
Loading
Loading
+4 −0
Changes for CHANGES: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@
Changes with Apache 2.3.0
  [Remove entries to the current 2.0 and 2.2 section below, when backported]
  *) mod_disk_cache: If possible, check if the size of an object to cache is
     within the configured boundaries before actually saving data.
     [Niklas Edmundsson <nikke acc.umu.se>]
  *) mod_cache: Convert all values to seconds before comparing them when
     checking whether to send a Warning header for a stale response.
     PR 39713. [Owen Taylor <otaylor redhat.com>]
+16 −0
Changes for modules/cache/mod_disk_cache.c: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -330,6 +330,22 @@ static int create_entity(cache_handle_t *h, request_rec *r, const char *key, apr
        return DECLINED;
    }

    /* Note, len is -1 if unknown so don't trust it too hard */
    if (len > conf->maxfs) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "disk_cache: URL %s failed the size check "
                     "(%" APR_OFF_T_FMT " > %" APR_SIZE_T_FMT ")",
                     key, len, conf->maxfs);
        return DECLINED;
    }
    if (len >= 0 && len < conf->minfs) {
        ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
                     "disk_cache: URL %s failed the size check "
                     "(%" APR_OFF_T_FMT " < %" APR_SIZE_T_FMT ")",
                     key, len, conf->minfs);
        return DECLINED;
    }

    /* Allocate and initialize cache_object_t and disk_cache_object_t */
    h->cache_obj = obj = apr_pcalloc(r->pool, sizeof(*obj));
    obj->vobj = dobj = apr_pcalloc(r->pool, sizeof(*dobj));