From: Ruediger Pluem Date: Sat, 3 Jun 2006 20:52:58 +0000 (+0000) Subject: * If possible, check if the size of an object to cache is within the X-Git-Tag: 2.3.0~2359 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cab5846455aee0b2b14e54c9bb4de8dd0b311b94;p=thirdparty%2Fapache%2Fhttpd.git * If possible, check if the size of an object to cache is within the configured boundaries before actually saving data. Submitted by: Niklas Edmundsson Reviewed by: rpluem git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@411469 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 18448445126..01e12d357d4 100644 --- a/CHANGES +++ b/CHANGES @@ -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 ] + *) 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 ] diff --git a/modules/cache/mod_disk_cache.c b/modules/cache/mod_disk_cache.c index 44a3279f467..1f14645e1a1 100644 --- a/modules/cache/mod_disk_cache.c +++ b/modules/cache/mod_disk_cache.c @@ -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));