Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
isv:cpanel:EA4
ea-apache2
0007-Update-CacheMaxExpire-to-have-a-hard-optio...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0007-Update-CacheMaxExpire-to-have-a-hard-option.patch of Package ea-apache2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cory McIntire <cory@cpanel.net> Date: Thu, 12 Jul 2018 15:34:24 -0500 Subject: [PATCH 07/21] Update CacheMaxExpire to have a "hard" option --- modules/cache/cache_util.h | 3 +++ modules/cache/mod_cache.c | 24 ++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/modules/cache/cache_util.h b/modules/cache/cache_util.h index 6b92151..4c42a8e 100644 --- a/modules/cache/cache_util.h +++ b/modules/cache/cache_util.h @@ -195,6 +195,9 @@ typedef struct { unsigned int store_nostore_set:1; unsigned int enable_set:1; unsigned int disable_set:1; + /* treat maxex as hard limit */ + unsigned int hardmaxex:1; + unsigned int hardmaxex_set:1; } cache_dir_conf; /* A linked-list of authn providers. */ diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 3b4469e..2d6ce95 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -1452,6 +1452,11 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) exp = date + dconf->defex; } } + /* else, forcibly cap the expiry date if required */ + else if (dconf->hardmaxex && (date + dconf->maxex) < exp) { + exp = date + dconf->maxex; + } + info->expire = exp; /* We found a stale entry which wasn't really stale. */ @@ -1951,7 +1956,9 @@ static void *create_dir_config(apr_pool_t *p, char *dummy) /* array of providers for this URL space */ dconf->cacheenable = apr_array_make(p, 10, sizeof(struct cache_enable)); - + /* flag; treat maxex as hard limit */ + dconf->hardmaxex = 0; + dconf->hardmaxex_set = 0; return dconf; } @@ -2001,7 +2008,10 @@ static void *merge_dir_config(apr_pool_t *p, void *basev, void *addv) { new->enable_set = add->enable_set || base->enable_set; new->disable = (add->disable_set == 0) ? base->disable : add->disable; new->disable_set = add->disable_set || base->disable_set; - + new->hardmaxex = + (add->hardmaxex_set == 0) + ? base->hardmaxex + : add->hardmaxex; return new; } @@ -2329,12 +2339,18 @@ static const char *add_cache_disable(cmd_parms *parms, void *dummy, } static const char *set_cache_maxex(cmd_parms *parms, void *dummy, - const char *arg) + const char *arg, const char *hard) { cache_dir_conf *dconf = (cache_dir_conf *)dummy; dconf->maxex = (apr_time_t) (atol(arg) * MSEC_ONE_SEC); dconf->maxex_set = 1; + + if (hard && strcasecmp(hard, "hard") == 0) { + dconf->hardmaxex = 1; + dconf->hardmaxex_set = 1; + } + return NULL; } @@ -2542,7 +2558,7 @@ static const command_rec cache_cmds[] = "caching is enabled"), AP_INIT_TAKE1("CacheDisable", add_cache_disable, NULL, RSRC_CONF|ACCESS_CONF, "A partial URL prefix below which caching is disabled"), - AP_INIT_TAKE1("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF|ACCESS_CONF, + AP_INIT_TAKE12("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF|ACCESS_CONF, "The maximum time in seconds to cache a document"), AP_INIT_TAKE1("CacheMinExpire", set_cache_minex, NULL, RSRC_CONF|ACCESS_CONF, "The minimum time in seconds to cache a document"),
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor