ASF Bugzilla – Attachment 12295 Details for
Bug 30399
mod_cache caching Set-Cookie headers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
CacheStoreCookies Patch
CacheStoreCookies.diff (text/plain), 5.78 KB, created by
Rüdiger Plüm
on 2004-08-01 10:38:51 UTC
(
hide
)
Description:
CacheStoreCookies Patch
Filename:
MIME Type:
Creator:
Rüdiger Plüm
Created:
2004-08-01 10:38:51 UTC
Size:
5.78 KB
patch
obsolete
>--- httpd-2.0.50/modules/experimental/cache_util.c.orig 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/cache_util.c 2004-08-01 02:18:13.000000000 +0200 >@@ -21,6 +21,8 @@ > > /* -------------------------------------------------------------- */ > >+extern module cache_module; >+ > /* return true if the request is conditional */ > CACHE_DECLARE(int) ap_cache_request_is_conditional(request_rec *r) > { >@@ -498,8 +500,11 @@ > * headers table that are allowed to be stored in a cache. > */ > CACHE_DECLARE(apr_table_t *)ap_cache_cacheable_hdrs_out(apr_pool_t *pool, >- apr_table_t *t) >+ apr_table_t *t, >+ server_rec *s) > { >+ cache_server_conf *conf; >+ > /* Make a copy of the headers, and remove from > * the copy any hop-by-hop headers, as defined in Section > * 13.5.1 of RFC 2616 >@@ -514,5 +519,8 @@ > apr_table_unset(headers_out, "Trailers"); > apr_table_unset(headers_out, "Transfer-Encoding"); > apr_table_unset(headers_out, "Upgrade"); >+ conf = (cache_server_conf *) ap_get_module_config(s->module_config, >+ &cache_module); >+ if (!conf->storecookies) apr_table_unset(headers_out, "Set-Cookie"); > return headers_out; > } >--- httpd-2.0.50/modules/experimental/mod_cache.c.orig 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/mod_cache.c 2004-08-01 01:58:59.000000000 +0200 >@@ -799,6 +799,9 @@ > ps->no_last_mod_ignore = 0; > ps->ignorecachecontrol = 0; > ps->ignorecachecontrol_set = 0 ; >+ /* store Set-Cookie headers by default to be RFC 2616 compliant */ >+ ps->storecookies = 1; >+ ps->storecookies_set = 0 ; > return ps; > } > >@@ -835,6 +838,10 @@ > (overrides->ignorecachecontrol_set == 0) > ? base->ignorecachecontrol > : overrides->ignorecachecontrol; >+ ps->storecookies = >+ (overrides->storecookies_set == 0) >+ ? base->storecookies >+ : overrides->storecookies; > return ps; > } > static const char *set_cache_ignore_no_last_mod(cmd_parms *parms, void *dummy, >@@ -864,6 +871,19 @@ > return NULL; > } > >+static const char *set_cache_store_cookies(cmd_parms *parms, >+ void *dummy, int flag) >+{ >+ cache_server_conf *conf; >+ >+ conf = >+ (cache_server_conf *)ap_get_module_config(parms->server->module_config, >+ &cache_module); >+ conf->storecookies = flag; >+ conf->storecookies_set = 1; >+ return NULL; >+} >+ > static const char *add_cache_enable(cmd_parms *parms, void *dummy, > const char *type, > const char *url) >@@ -994,6 +1014,10 @@ > NULL, > RSRC_CONF, > "Ignore requests from the client for uncached content"), >+ AP_INIT_FLAG("CacheStoreCookies", set_cache_store_cookies, >+ NULL, >+ RSRC_CONF, >+ "Store Set-Cookie headers in cached headers"), > AP_INIT_TAKE1("CacheLastModifiedFactor", set_cache_factor, NULL, RSRC_CONF, > "The factor used to estimate Expires date from " > "LastModified date"), >--- httpd-2.0.50/modules/experimental/mod_cache.h.orig 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/mod_cache.h 2004-08-01 02:02:53.000000000 +0200 >@@ -136,6 +136,9 @@ > /** ignore client's requests for uncached responses */ > int ignorecachecontrol; > int ignorecachecontrol_set; >+ /** store Set-Cookie headers */ >+ int storecookies; >+ int storecookies_set; > } cache_server_conf; > > /* cache info information */ >@@ -236,7 +239,7 @@ > /* Create a new table consisting of those elements from a request_rec's > * headers_out that are allowed to be stored in a cache > */ >-CACHE_DECLARE(apr_table_t *)ap_cache_cacheable_hdrs_out(apr_pool_t *pool, apr_table_t *t); >+CACHE_DECLARE(apr_table_t *)ap_cache_cacheable_hdrs_out(apr_pool_t *pool, apr_table_t *t, server_rec *s); > > /** > * cache_storage.c >--- httpd-2.0.50/modules/experimental/mod_disk_cache.c.orig 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/mod_disk_cache.c 2004-08-01 02:03:09.000000000 +0200 >@@ -560,7 +560,7 @@ > > if (r->headers_out) { > int i; >- apr_table_t* headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out); >+ apr_table_t* headers_out = ap_cache_cacheable_hdrs_out(r->pool, r->headers_out, r->server); > apr_table_entry_t *elts = (apr_table_entry_t *) apr_table_elts(headers_out)->elts; > for (i = 0; i < apr_table_elts(headers_out)->nelts; ++i) { > if (elts[i].key != NULL) { >--- httpd-2.0.50/modules/experimental/mod_mem_cache.c.orig 2004-02-09 21:53:16.000000000 +0100 >+++ httpd-2.0.50/modules/experimental/mod_mem_cache.c 2004-08-01 02:03:24.000000000 +0200 >@@ -822,13 +822,15 @@ > /* Precompute how much storage we need to hold the headers */ > rc = serialize_table(&mobj->header_out, > &mobj->num_header_out, >- ap_cache_cacheable_hdrs_out(r->pool, r->headers_out)); >+ ap_cache_cacheable_hdrs_out(r->pool, r->headers_out, >+ r->server)); > if (rc != APR_SUCCESS) { > return rc; > } > rc = serialize_table(&mobj->err_header_out, > &mobj->num_err_header_out, >- ap_cache_cacheable_hdrs_out(r->pool, r->err_headers_out)); >+ ap_cache_cacheable_hdrs_out(r->pool, r->err_headers_out, >+ r->server)); > if (rc != APR_SUCCESS) { > return rc; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 30399
: 12295 |
12877
|
13097
|
14434