Ruediger Pluem wrote:
Providing a better reference to the patch you are talking about would be a
start :-).
Of course, and now when I'm trying to find Davi's mail from the 18th of
January in the archive it seems to be missing, so maybe it didn't even
make it to the list :( So here is his patch again.
The original problem was described in:
http://mail-archives.apache.org/mod_mbox/httpd-dev/200701.mbox/[EMAIL PROTECTED]
Regards,
Bart
Index: modules/cache/mod_cache.c
===================================================================
--- modules/cache/mod_cache.c (revision 497262)
+++ modules/cache/mod_cache.c (working copy)
@@ -372,13 +372,8 @@
exps = apr_table_get(r->headers_out, "Expires");
}
if (exps != NULL) {
- if (APR_DATE_BAD == (exp = apr_date_parse_http(exps))) {
- exps = NULL;
- }
+ exp = apr_date_parse_http(exps);
}
- else {
- exp = APR_DATE_BAD;
- }
/* read the last-modified date; if the date is bad, then delete it */
lastmods = apr_table_get(r->err_headers_out, "Last-Modified");
@@ -424,21 +419,24 @@
*/
reason = apr_psprintf(p, "Response status %d", r->status);
}
+ else if (r->args && exps == NULL) {
+ /* if query string present but no expiration time, don't cache it
+ * (RFC 2616/13.9)
+ */
+ reason = "Query string present but no expires header";
+ }
+ /* XXX: APR_DATE_BAD (0) is a valid date */
else if (exps != NULL && exp == APR_DATE_BAD) {
/* 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 (exps != NULL && exp < r->request_time)
{
- /* if a Expires header is in the past, don't cache it */
+ /* if a Expires header is in the past, don't cache it.
+ * it may also be a broken header too, anyway.. we won't cache it
+ */
reason = "Expires header already expired, not cacheable";
}
- else if (r->args && exps == NULL) {
- /* if query string present but no expiration time, don't cache it
- * (RFC 2616/13.9)
- */
- reason = "Query string present but no expires header";
- }
else if (r->status == HTTP_NOT_MODIFIED &&
!cache->handle && !cache->stale_handle) {
/* if the server said 304 Not Modified but we have no cache
@@ -686,7 +684,7 @@
* else
* expire date = date + defaultexpire
*/
- if (exp == APR_DATE_BAD) {
+ if (exps == NULL) {
char expire_hdr[APR_RFC822_DATE_LEN];
/* if lastmod == date then you get 0*conf->factor which results in