]> granicus.if.org Git - apache/commitdiff
* If possible, check if the size of an object to cache is within the
authorRuediger Pluem <rpluem@apache.org>
Sat, 3 Jun 2006 20:52:58 +0000 (20:52 +0000)
committerRuediger Pluem <rpluem@apache.org>
Sat, 3 Jun 2006 20:52:58 +0000 (20:52 +0000)
  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

CHANGES
modules/cache/mod_disk_cache.c

diff --git a/CHANGES b/CHANGES
index 18448445126f7e006df3b5eeb01df5a13e84908f..01e12d357d4e9a697e580174130563ef8bb52448 100644 (file)
--- 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 <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>]
index 44a3279f46773d31e309988388f8bb13d7ca34f2..1f14645e1a1347b5d6ba056a930fc3d0d43b8ce5 100644 (file)
@@ -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));