From: Bill Stoddard Date: Wed, 30 Oct 2002 14:01:35 +0000 (+0000) Subject: Use r->request_time in lieu of apr_time_now() in cache object age calculations X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2227b4974a5f1e7debae4fbacba72feda146653a;p=apache Use r->request_time in lieu of apr_time_now() in cache object age calculations git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97351 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/cache_util.c b/modules/experimental/cache_util.c index dcdb9e6ba0..7bde810dd0 100644 --- a/modules/experimental/cache_util.c +++ b/modules/experimental/cache_util.c @@ -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)) diff --git a/modules/experimental/mod_cache.h b/modules/experimental/mod_cache.h index 159414a5ba..bfc460e0e1 100644 --- a/modules/experimental/mod_cache.h +++ b/modules/experimental/mod_cache.h @@ -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)