]> granicus.if.org Git - apache/commitdiff
Use r->request_time in lieu of apr_time_now() in cache object age calculations
authorBill Stoddard <stoddard@apache.org>
Wed, 30 Oct 2002 14:01:35 +0000 (14:01 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 30 Oct 2002 14:01:35 +0000 (14:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97351 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/cache_util.c
modules/experimental/mod_cache.h

index dcdb9e6ba0752f01f0412758bc37c9531ec6297c..7bde810dd0d50a0537ae86335aea60ade4c1092e 100644 (file)
@@ -138,7 +138,8 @@ CACHE_DECLARE(const char *)ap_cache_get_cachetype(request_rec *r,
 
 
 /* do a HTTP/1.1 age calculation */
-CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info, const apr_time_t age_value)
+CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info, const apr_time_t age_value,
+                                                apr_time_t now)
 {
     apr_time_t apparent_age, corrected_received_age, response_delay, corrected_initial_age,
            resident_time, current_age;
@@ -149,7 +150,7 @@ CACHE_DECLARE(apr_int64_t) ap_cache_current_age(cache_info *info, const apr_time
     corrected_received_age = MAX(apparent_age, age_value);
     response_delay = info->response_time - info->request_time;
     corrected_initial_age = corrected_received_age + response_delay;
-    resident_time = apr_time_now() - info->response_time;
+    resident_time = now - info->response_time;
     current_age = corrected_initial_age + resident_time;
 
     return apr_time_sec(current_age);
@@ -206,7 +207,7 @@ CACHE_DECLARE(int) ap_cache_check_freshness(cache_request_rec *cache,
     }
 
     /* calculate age of object */
-    age = ap_cache_current_age(info, age_c);
+    age = ap_cache_current_age(info, age_c, r->request_time);
 
     /* extract s-maxage */
     if (cc_cresp && ap_cache_liststr(r->pool, cc_cresp, "s-maxage", &val))
index 159414a5bad52114807387409e5adbafb1df247a..bfc460e0e17fc916bb3c03affe2a46d4d2d4a7cd 100644 (file)
@@ -257,7 +257,8 @@ typedef struct {
 
 /* cache_util.c */
 /* do a HTTP/1.1 age calculation */
-CACHE_DECLARE(apr_time_t) ap_cache_current_age(cache_info *info, const apr_time_t age_value);
+CACHE_DECLARE(apr_time_t) ap_cache_current_age(cache_info *info, const apr_time_t age_value,
+                                               apr_time_t now);
 
 /**
  * Check the freshness of the cache object per RFC2616 section 13.2 (Expiration Model)