You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2010/09/22 19:54:39 UTC
svn commit: r1000106 - in /httpd/httpd/trunk: docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Author: wrowe
Date: Wed Sep 22 17:54:39 2010
New Revision: 1000106
URL: http://svn.apache.org/viewvc?rev=1000106&view=rev
Log:
Revert breakage in 2.2.4 introduced in r450055, by offering a CacheStoreExpired
directive to allow the user to override this questionable change.
Modified:
httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
httpd/httpd/trunk/modules/cache/mod_cache.c
httpd/httpd/trunk/modules/cache/mod_cache.h
Modified: httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_cache.xml?rev=1000106&r1=1000105&r2=1000106&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_cache.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_cache.xml Wed Sep 22 17:54:39 2010
@@ -585,6 +585,30 @@ LastModified date.</description>
</directivesynopsis>
<directivesynopsis>
+<name>CacheStoreExpired</name>
+<description>Attempt to cache responses that the server reports as expired</description>
+<syntax>CacheStoreExpired On|Off</syntax>
+<default>CacheStoreExpired Off</default>
+<contextlist><context>server config</context><context>virtual host</context>
+</contextlist>
+
+<usage>
+ <p>Since httpd 2.2.4, responses which are already-expired are not stored
+ stored in the cache. The <directive>CacheStoreExpired</directive>
+ directive allows this behavior to be overridden.
+ <directive>CacheStoreExpired</directive> On
+ tells the server to attempt to cache the resource if it is stale.
+ Subsequent requests would trigger an If-Modified-Since request of
+ the origin server, and the response may be fulfilled from cache
+ if the backend resource has not changed.</p>
+
+ <example>
+ CacheStoreExpired On
+ </example>
+</usage>
+</directivesynopsis>
+
+<directivesynopsis>
<name>CacheStorePrivate</name>
<description>Attempt to cache responses that the server has marked as private</description>
<syntax>CacheStorePrivate On|Off</syntax>
Modified: httpd/httpd/trunk/modules/cache/mod_cache.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1000106&r1=1000105&r2=1000106&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.c (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.c Wed Sep 22 17:54:39 2010
@@ -817,7 +817,8 @@ static int cache_save_filter(ap_filter_t
/* if a broken Expires header is present, don't cache it */
reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
}
- else if (exp != APR_DATE_BAD && exp < r->request_time)
+ else if (!conf->store_expired && exp != APR_DATE_BAD
+ && exp < r->request_time)
{
/* if a Expires header is in the past, don't cache it */
reason = "Expires header already expired, not cacheable";
@@ -1340,6 +1341,8 @@ static void * create_cache_config(apr_po
ps->no_last_mod_ignore = 0;
ps->ignorecachecontrol = 0;
ps->ignorecachecontrol_set = 0;
+ ps->store_expired = 0;
+ ps->store_expired_set = 0;
ps->store_private = 0;
ps->store_private_set = 0;
ps->store_nostore = 0;
@@ -1397,6 +1400,10 @@ static void * merge_cache_config(apr_poo
(overrides->ignorecachecontrol_set == 0)
? base->ignorecachecontrol
: overrides->ignorecachecontrol;
+ ps->store_expired =
+ (overrides->store_expired_set == 0)
+ ? base->store_expired
+ : overrides->store_expired;
ps->store_private =
(overrides->store_private_set == 0)
? base->store_private
@@ -1478,6 +1485,19 @@ static const char *set_cache_ignore_cach
return NULL;
}
+static const char *set_cache_store_expired(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->store_expired = flag;
+ conf->store_expired_set = 1;
+ return NULL;
+}
+
static const char *set_cache_store_private(cmd_parms *parms, void *dummy,
int flag)
{
@@ -1812,6 +1832,10 @@ static const command_rec cache_cmds[] =
AP_INIT_FLAG("CacheIgnoreCacheControl", set_cache_ignore_cachecontrol,
NULL, RSRC_CONF,
"Ignore requests from the client for uncached content"),
+ AP_INIT_FLAG("CacheStoreExpired", set_cache_store_expired,
+ NULL, RSRC_CONF,
+ "Ignore expiration dates when populating cache, resulting in "
+ "an If-Modified-Since request to the backend on retrieval"),
AP_INIT_FLAG("CacheStorePrivate", set_cache_store_private,
NULL, RSRC_CONF,
"Ignore 'Cache-Control: private' and store private content"),
Modified: httpd/httpd/trunk/modules/cache/mod_cache.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.h?rev=1000106&r1=1000105&r2=1000106&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/cache/mod_cache.h (original)
+++ httpd/httpd/trunk/modules/cache/mod_cache.h Wed Sep 22 17:54:39 2010
@@ -141,6 +141,9 @@ typedef struct {
/** ignore client's requests for uncached responses */
int ignorecachecontrol;
int ignorecachecontrol_set;
+ /** ignore expiration date from server */
+ int store_expired;
+ int store_expired_set;
/** ignore Cache-Control: private header from server */
int store_private;
int store_private_set;
Re: svn commit: r1000106 - in /httpd/httpd/trunk: docs/manual/mod/mod_cache.xml
modules/cache/mod_cache.c modules/cache/mod_cache.h
Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Sep 22, 2010 at 1:54 PM, <wr...@apache.org> wrote:
> Author: wrowe
> Date: Wed Sep 22 17:54:39 2010
> New Revision: 1000106
>
> URL: http://svn.apache.org/viewvc?rev=1000106&view=rev
> Log:
> Revert breakage in 2.2.4 introduced in r450055, by offering a
> CacheStoreExpired
> directive to allow the user to override this questionable change.
>
> Modified:
> httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
> httpd/httpd/trunk/modules/cache/mod_cache.c
> httpd/httpd/trunk/modules/cache/mod_cache.h
>
> Modified: httpd/httpd/trunk/docs/manual/mod/mod_cache.xml
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_cache.xml?rev=1000106&r1=1000105&r2=1000106&view=diff
>
> ==============================================================================
> --- httpd/httpd/trunk/docs/manual/mod/mod_cache.xml (original)
> +++ httpd/httpd/trunk/docs/manual/mod/mod_cache.xml Wed Sep 22 17:54:39
> 2010
> @@ -585,6 +585,30 @@ LastModified date.</description>
> </directivesynopsis>
>
> <directivesynopsis>
> +<name>CacheStoreExpired</name>
> +<description>Attempt to cache responses that the server reports as
> expired</description>
> +<syntax>CacheStoreExpired On|Off</syntax>
> +<default>CacheStoreExpired Off</default>
> +<contextlist><context>server config</context><context>virtual
> host</context>
> +</contextlist>
> +
> +<usage>
> + <p>Since httpd 2.2.4, responses which are already-expired are not
> stored
> + stored in the cache. The <directive>CacheStoreExpired</directive>
>
"stored" is duplicated