]> Raphaƫl G. Git Repositories - ihttpd/blob - SOURCES/httpd-2.4.4-cachehardmax.patch
Add formid
[ihttpd] / SOURCES / httpd-2.4.4-cachehardmax.patch
1 diff --git a/modules/cache/cache_util.h b/modules/cache/cache_util.h
2 index eec38f3..1a2d5ee 100644
3 --- a/modules/cache/cache_util.h
4 +++ b/modules/cache/cache_util.h
5 @@ -194,6 +194,9 @@ typedef struct {
6 unsigned int store_nostore_set:1;
7 unsigned int enable_set:1;
8 unsigned int disable_set:1;
9 + /* treat maxex as hard limit */
10 + unsigned int hardmaxex:1;
11 + unsigned int hardmaxex_set:1;
12 } cache_dir_conf;
13
14 /* A linked-list of authn providers. */
15 diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c
16 index 4f2d3e0..30c88f4 100644
17 --- a/modules/cache/mod_cache.c
18 +++ b/modules/cache/mod_cache.c
19 @@ -1299,6 +1299,11 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in)
20 exp = date + dconf->defex;
21 }
22 }
23 + /* else, forcibly cap the expiry date if required */
24 + else if (dconf->hardmaxex && (date + dconf->maxex) < exp) {
25 + exp = date + dconf->maxex;
26 + }
27 +
28 info->expire = exp;
29
30 /* We found a stale entry which wasn't really stale. */
31 @@ -1717,7 +1722,9 @@ static void *create_dir_config(apr_pool_t *p, char *dummy)
32
33 /* array of providers for this URL space */
34 dconf->cacheenable = apr_array_make(p, 10, sizeof(struct cache_enable));
35 -
36 + /* flag; treat maxex as hard limit */
37 + dconf->hardmaxex = 0;
38 + dconf->hardmaxex_set = 0;
39 return dconf;
40 }
41
42 @@ -1767,7 +1774,10 @@ static void *merge_dir_config(apr_pool_t *p, void *basev, void *addv) {
43 new->enable_set = add->enable_set || base->enable_set;
44 new->disable = (add->disable_set == 0) ? base->disable : add->disable;
45 new->disable_set = add->disable_set || base->disable_set;
46 -
47 + new->hardmaxex =
48 + (add->hardmaxex_set == 0)
49 + ? base->hardmaxex
50 + : add->hardmaxex;
51 return new;
52 }
53
54 @@ -2096,12 +2106,18 @@ static const char *add_cache_disable(cmd_parms *parms, void *dummy,
55 }
56
57 static const char *set_cache_maxex(cmd_parms *parms, void *dummy,
58 - const char *arg)
59 + const char *arg, const char *hard)
60 {
61 cache_dir_conf *dconf = (cache_dir_conf *)dummy;
62
63 dconf->maxex = (apr_time_t) (atol(arg) * MSEC_ONE_SEC);
64 dconf->maxex_set = 1;
65 +
66 + if (hard && strcasecmp(hard, "hard") == 0) {
67 + dconf->hardmaxex = 1;
68 + dconf->hardmaxex_set = 1;
69 + }
70 +
71 return NULL;
72 }
73
74 @@ -2309,7 +2325,7 @@ static const command_rec cache_cmds[] =
75 "caching is enabled"),
76 AP_INIT_TAKE1("CacheDisable", add_cache_disable, NULL, RSRC_CONF|ACCESS_CONF,
77 "A partial URL prefix below which caching is disabled"),
78 - AP_INIT_TAKE1("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF|ACCESS_CONF,
79 + AP_INIT_TAKE12("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF|ACCESS_CONF,
80 "The maximum time in seconds to cache a document"),
81 AP_INIT_TAKE1("CacheMinExpire", set_cache_minex, NULL, RSRC_CONF|ACCESS_CONF,
82 "The minimum time in seconds to cache a document"),