httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r411469 - in /httpd/httpd/trunk: CHANGES modules/cache/mod_disk_cache.c
Date Sat, 03 Jun 2006 20:52:58 GMT
Author: rpluem
Date: Sat Jun  3 13:52:58 2006
New Revision: 411469

URL: http://svn.apache.org/viewvc?rev=411469&view=rev
Log:
* 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

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/cache/mod_disk_cache.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=411469&r1=411468&r2=411469&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Jun  3 13:52:58 2006
@@ -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>]

Modified: httpd/httpd/trunk/modules/cache/mod_disk_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_disk_cache.c?rev=411469&r1=411468&r2=411469&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_disk_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_disk_cache.c Sat Jun  3 13:52:58 2006
@@ -330,6 +330,22 @@
         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));



Mime
View raw message