Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 15103 invoked from network); 22 Sep 2010 19:35:52 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Sep 2010 19:35:52 -0000 Received: (qmail 24052 invoked by uid 500); 22 Sep 2010 19:35:52 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 23904 invoked by uid 500); 22 Sep 2010 19:35:52 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 23897 invoked by uid 99); 22 Sep 2010 19:35:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 19:35:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Sep 2010 19:35:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F1E212388A36; Wed, 22 Sep 2010 19:35:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1000152 - in /httpd/httpd/trunk/modules/cache: cache_storage.c cache_storage.h cache_util.c mod_cache.c mod_cache.h Date: Wed, 22 Sep 2010 19:35:26 -0000 To: cvs@httpd.apache.org From: minfrin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100922193526.F1E212388A36@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: minfrin Date: Wed Sep 22 19:35:26 2010 New Revision: 1000152 URL: http://svn.apache.org/viewvc?rev=1000152&view=rev Log: Remove the MOD_CACHE_REQUEST_REC hack, and pass the cache_request_rec structure through mod_cache's function parameters in the usual way. Modified: httpd/httpd/trunk/modules/cache/cache_storage.c httpd/httpd/trunk/modules/cache/cache_storage.h httpd/httpd/trunk/modules/cache/cache_util.c httpd/httpd/trunk/modules/cache/mod_cache.c httpd/httpd/trunk/modules/cache/mod_cache.h Modified: httpd/httpd/trunk/modules/cache/cache_storage.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_storage.c?rev=1000152&r1=1000151&r2=1000152&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/cache_storage.c (original) +++ httpd/httpd/trunk/modules/cache/cache_storage.c Wed Sep 22 19:35:26 2010 @@ -68,19 +68,15 @@ int cache_remove_url(cache_request_rec * * decide whether or not it wants to cache this particular entity. * If the size is unknown, a size of -1 should be set. */ -int cache_create_entity(request_rec *r, apr_off_t size, apr_bucket_brigade *in) +int cache_create_entity(cache_request_rec *cache, request_rec *r, + apr_off_t size, apr_bucket_brigade *in) { cache_provider_list *list; cache_handle_t *h = apr_pcalloc(r->pool, sizeof(cache_handle_t)); char *key; apr_status_t rv; - cache_request_rec *cache; - void *data; - apr_pool_userdata_get(&data, MOD_CACHE_REQUEST_REC, r->pool); - cache = data; - - rv = cache_generate_key(r, r->pool, &key); + rv = cache_generate_key(cache, r, r->pool, &key); if (rv != APR_SUCCESS) { return rv; } @@ -189,19 +185,14 @@ CACHE_DECLARE(void) ap_cache_accept_head * This function returns OK if successful, DECLINED if no * cached entity fits the bill. */ -int cache_select(request_rec *r) +int cache_select(cache_request_rec *cache, request_rec *r) { cache_provider_list *list; apr_status_t rv; cache_handle_t *h; char *key; - cache_request_rec *cache; - void *data; - - apr_pool_userdata_get(&data, MOD_CACHE_REQUEST_REC, r->pool); - cache = data; - rv = cache_generate_key(r, r->pool, &key); + rv = cache_generate_key(cache, r, r->pool, &key); if (rv != APR_SUCCESS) { return rv; } @@ -282,7 +273,7 @@ int cache_select(request_rec *r) cache->provider_name = list->provider_name; /* Is our cached response fresh enough? */ - fresh = ap_cache_check_freshness(h, r); + fresh = ap_cache_check_freshness(h, cache, r); if (!fresh) { const char *etag, *lastmod; @@ -366,19 +357,15 @@ int cache_select(request_rec *r) return DECLINED; } -apr_status_t cache_generate_key_default(request_rec *r, apr_pool_t* p, - char**key) +apr_status_t cache_generate_key_default(cache_request_rec *cache, request_rec *r, + apr_pool_t* p, char **key) { cache_server_conf *conf; - cache_request_rec *cache; char *port_str, *hn, *lcs; const char *hostname, *scheme; int i; char *path, *querystring; - void *data; - apr_pool_userdata_get(&data, MOD_CACHE_REQUEST_REC, r->pool); - cache = data; if (!cache) { /* This should never happen */ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, Modified: httpd/httpd/trunk/modules/cache/cache_storage.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_storage.h?rev=1000152&r1=1000151&r2=1000152&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/cache_storage.h (original) +++ httpd/httpd/trunk/modules/cache/cache_storage.h Wed Sep 22 19:35:26 2010 @@ -35,11 +35,12 @@ extern "C" { /** * cache_storage.c */ -#define MOD_CACHE_REQUEST_REC "mod_cache_request_rec" int cache_remove_url(cache_request_rec *cache, apr_pool_t *p); -int cache_create_entity(request_rec *r, apr_off_t size, apr_bucket_brigade *in); -int cache_select(request_rec *r); -apr_status_t cache_generate_key_default( request_rec *r, apr_pool_t*p, char**key ); +int cache_create_entity(cache_request_rec *cache, request_rec *r, + apr_off_t size, apr_bucket_brigade *in); +int cache_select(cache_request_rec *cache, request_rec *r); +apr_status_t cache_generate_key_default(cache_request_rec *cache, request_rec *r, + apr_pool_t* p, char **key); #ifdef __cplusplus } Modified: httpd/httpd/trunk/modules/cache/cache_util.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1000152&r1=1000151&r2=1000152&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/cache_util.c (original) +++ httpd/httpd/trunk/modules/cache/cache_util.c Wed Sep 22 19:35:26 2010 @@ -230,7 +230,8 @@ CACHE_DECLARE(apr_int64_t) ap_cache_curr * the backend. */ CACHE_DECLARE(apr_status_t) ap_cache_try_lock(cache_server_conf *conf, - request_rec *r, char *key) { + cache_request_rec *cache, request_rec *r, char *key) +{ apr_status_t status; const char *lockname; const char *path; @@ -255,7 +256,7 @@ CACHE_DECLARE(apr_status_t) ap_cache_try /* create the key if it doesn't exist */ if (!key) { - cache_generate_key(r, r->pool, &key); + cache_generate_key(cache, r, r->pool, &key); } /* create a hashed filename from the key, and save it for later */ @@ -322,7 +323,9 @@ CACHE_DECLARE(apr_status_t) ap_cache_try * removed if the bucket brigade contains an EOS bucket. */ CACHE_DECLARE(apr_status_t) ap_cache_remove_lock(cache_server_conf *conf, - request_rec *r, char *key, apr_bucket_brigade *bb) { + cache_request_rec *cache, request_rec *r, char *key, + apr_bucket_brigade *bb) +{ void *dummy; const char *lockname; @@ -360,7 +363,7 @@ CACHE_DECLARE(apr_status_t) ap_cache_rem /* create the key if it doesn't exist */ if (!key) { - cache_generate_key(r, r->pool, &key); + cache_generate_key(cache, r, r->pool, &key); } /* create a hashed filename from the key, and save it for later */ @@ -439,6 +442,7 @@ CACHE_DECLARE(int) ap_cache_check_allowe CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, + cache_request_rec *cache, request_rec *r) { apr_status_t status; @@ -687,7 +691,7 @@ CACHE_DECLARE(int) ap_cache_check_freshn * A lock that exceeds a maximum age will be deleted, and another * request gets to make a new lock and try again. */ - status = ap_cache_try_lock(conf, r, (char *)h->cache_obj->key); + status = ap_cache_try_lock(conf, cache, r, (char *)h->cache_obj->key); if (APR_SUCCESS == status) { /* we obtained a lock, follow the stale path */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, Modified: httpd/httpd/trunk/modules/cache/mod_cache.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1000152&r1=1000151&r2=1000152&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/mod_cache.c (original) +++ httpd/httpd/trunk/modules/cache/mod_cache.c Wed Sep 22 19:35:26 2010 @@ -98,9 +98,6 @@ static int cache_quick_handler(request_r cache->size = -1; cache->out = apr_brigade_create(r->pool, r->connection->bucket_alloc); - /* store away the per request config where the API can find it */ - apr_pool_userdata_setn(cache, MOD_CACHE_REQUEST_REC, NULL, r->pool); - /* save away the possible providers */ cache->providers = providers; @@ -128,7 +125,7 @@ static int cache_quick_handler(request_r * add cache_out filter * return OK */ - rv = cache_select(r); + rv = cache_select(cache, r); if (rv != OK) { if (rv == DECLINED) { if (!lookup) { @@ -140,7 +137,7 @@ static int cache_quick_handler(request_r * backend without any attempt to cache. this stops * duplicated simultaneous attempts to cache an entity. */ - rv = ap_cache_try_lock(conf, r, NULL); + rv = ap_cache_try_lock(conf, cache, r, NULL); if (APR_SUCCESS == rv) { /* @@ -358,9 +355,6 @@ static int cache_handler(request_rec *r) cache->size = -1; cache->out = apr_brigade_create(r->pool, r->connection->bucket_alloc); - /* store away the per request config where the API can find it */ - apr_pool_userdata_setn(cache, MOD_CACHE_REQUEST_REC, NULL, r->pool); - /* save away the possible providers */ cache->providers = providers; @@ -374,7 +368,7 @@ static int cache_handler(request_rec *r) * add cache_out filter * return OK */ - rv = cache_select(r); + rv = cache_select(cache, r); if (rv != OK) { if (rv == DECLINED) { @@ -385,7 +379,7 @@ static int cache_handler(request_rec *r) * backend without any attempt to cache. this stops * duplicated simultaneous attempts to cache an entity. */ - rv = ap_cache_try_lock(conf, r, NULL); + rv = ap_cache_try_lock(conf, cache, r, NULL); if (APR_SUCCESS == rv) { /* @@ -596,7 +590,7 @@ static int cache_save_store(ap_filter_t ap_remove_output_filter(f); /* give someone else the chance to cache the file */ - ap_cache_remove_lock(conf, f->r, cache->handle ? + ap_cache_remove_lock(conf, cache, f->r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); /* give up trying to cache, just step out the way */ @@ -617,7 +611,7 @@ static int cache_save_store(ap_filter_t } /* conditionally remove the lock as soon as we see the eos bucket */ - ap_cache_remove_lock(conf, f->r, cache->handle ? + ap_cache_remove_lock(conf, cache, f->r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, cache->out); if (APR_BRIGADE_EMPTY(cache->out)) { @@ -638,7 +632,7 @@ static int cache_save_store(ap_filter_t ap_remove_output_filter(f); /* give someone else the chance to cache the file */ - ap_cache_remove_lock(conf, f->r, cache->handle ? + ap_cache_remove_lock(conf, cache, f->r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); return ap_pass_brigade(f->next, in); @@ -912,7 +906,7 @@ static int cache_save_filter(ap_filter_t ap_remove_output_filter(f); /* remove the lock file unconditionally */ - ap_cache_remove_lock(conf, r, cache->handle ? + ap_cache_remove_lock(conf, cache, r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); /* ship the data up the stack */ @@ -1007,7 +1001,7 @@ static int cache_save_filter(ap_filter_t /* no cache handle, create a new entity only for non-HEAD requests */ if (!cache->handle && !r->header_only) { - rv = cache_create_entity(r, size, in); + rv = cache_create_entity(cache, r, size, in); info = apr_pcalloc(r->pool, sizeof(cache_info)); /* We only set info->status upon the initial creation. */ info->status = r->status; @@ -1016,7 +1010,7 @@ static int cache_save_filter(ap_filter_t if (rv != OK) { /* Caching layer declined the opportunity to cache the response */ ap_remove_output_filter(f); - ap_cache_remove_lock(conf, r, cache->handle ? + ap_cache_remove_lock(conf, cache, r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); return ap_pass_brigade(f->next, in); } @@ -1219,7 +1213,7 @@ static int cache_save_filter(ap_filter_t } /* let someone else attempt to cache */ - ap_cache_remove_lock(conf, r, cache->handle ? + ap_cache_remove_lock(conf, cache, r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); return ap_pass_brigade(f->next, bb); @@ -1230,7 +1224,7 @@ static int cache_save_filter(ap_filter_t "cache: store_headers failed"); ap_remove_output_filter(f); - ap_cache_remove_lock(conf, r, cache->handle ? + ap_cache_remove_lock(conf, cache, r, cache->handle ? (char *)cache->handle->cache_obj->key : NULL, NULL); return ap_pass_brigade(f->next, in); } Modified: httpd/httpd/trunk/modules/cache/mod_cache.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.h?rev=1000152&r1=1000151&r2=1000152&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/mod_cache.h (original) +++ httpd/httpd/trunk/modules/cache/mod_cache.h Wed Sep 22 19:35:26 2010 @@ -260,7 +260,7 @@ typedef struct { cache_provider_list *providers; /* possible cache providers */ const cache_provider *provider; /* current cache provider */ const char *provider_name; /* current cache provider name */ - int fresh; /* is the entitey fresh? */ + int fresh; /* is the entity fresh? */ cache_handle_t *handle; /* current cache handle */ cache_handle_t *stale_handle; /* stale cache handle */ apr_table_t *stale_headers; /* original request headers. */ @@ -291,7 +291,8 @@ CACHE_DECLARE(apr_time_t) ap_cache_curre * @param r request_rec * @return 0 ==> cache object is stale, 1 ==> cache object is fresh */ -CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, request_rec *r); +CACHE_DECLARE(int) ap_cache_check_freshness(cache_handle_t *h, cache_request_rec *cache, + request_rec *r); /** * Check the whether the request allows a cached object to be served as per RFC2616 @@ -324,7 +325,7 @@ CACHE_DECLARE(int) ap_cache_check_allowe * the backend. */ CACHE_DECLARE(apr_status_t) ap_cache_try_lock(cache_server_conf *conf, - request_rec *r, char *key); + cache_request_rec *cache, request_rec *r, char *key); /** * Remove the cache lock, if present. @@ -339,7 +340,8 @@ CACHE_DECLARE(apr_status_t) ap_cache_try * removed if the bucket brigade contains an EOS bucket. */ CACHE_DECLARE(apr_status_t) ap_cache_remove_lock(cache_server_conf *conf, - request_rec *r, char *key, apr_bucket_brigade *bb); + cache_request_rec *cache, request_rec *r, char *key, + apr_bucket_brigade *bb); /** * Merge in cached headers into the response @@ -390,7 +392,8 @@ CACHE_DECLARE(apr_table_t *)ap_cache_cac APR_DECLARE_OPTIONAL_FN(apr_status_t, ap_cache_generate_key, - (request_rec *r, apr_pool_t*p, char**key )); + (cache_request_rec *cache, request_rec *r, + apr_pool_t*p, char **key)); #endif /*MOD_CACHE_H*/