Skip to content

Commit a0ab7b5

Browse files
committed
Backport from 2.1.
*) mod_cache: Fix the cache code so that responses can be cached if they have an Expires header but no Etag or Last-Modified headers. PR 23130. [bjorn@exoweb.net] Reviewed by: Paul J. Reder, Roy T. Fielding, Brian Pane git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@101326 13f79535-47bb-0310-9956-ffa450edef68
1 parent 72060fa commit a0ab7b5

3 files changed

Lines changed: 11 additions & 13 deletions

File tree

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changes with Apache 2.0.48
22

3+
*) mod_cache: Fix the cache code so that responses can be cached
4+
if they have an Expires header but no Etag or Last-Modified
5+
headers. PR 23130.
6+
[bjorn@exoweb.net]
7+
38
*) mod_log_config: Fix %b log format to write really "-" when 0 bytes
49
were sent (e.g. with 304 or 204 response codes). [Astrid Ke�ler]
510

STATUS

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APACHE 2.0 STATUS: -*-text-*-
2-
Last modified at [$Date: 2003/09/27 18:13:12 $]
2+
Last modified at [$Date: 2003/09/27 18:17:09 $]
33

44
Release:
55

@@ -65,12 +65,6 @@ PATCHES TO PORT FROM 2.1
6565
[ please place file names and revisions from HEAD here, so it is easy to
6666
identify exactly what the proposed changes are! ]
6767

68-
* The cache code should be able to cache a response if it has an
69-
Expires header but no Etag or Last-Modified headers. This submitted
70-
patch (by bjorn@exoweb.net) resolves PR 23130.
71-
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/experimental/mod_cache.c.diff?r1=1.76&r2=1.77
72-
+1: rederpj, fielding, brianp
73-
7468
* Modifies the cache code to be header-location agnostic. Also
7569
fixes a number of other cache code bugs related to PR 15852
7670
(an RFC 2616 violation).

modules/experimental/mod_cache.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,14 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
540540
reason = "HTTP Status 304 Not Modified";
541541
}
542542
else if (r->status == HTTP_OK && lastmods == NULL && etag == NULL
543-
&& (conf->no_last_mod_ignore ==0)) {
544-
/* 200 OK response from HTTP/1.0 and up without a Last-Modified
545-
* header/Etag
543+
&& (exps == NULL) && (conf->no_last_mod_ignore ==0)) {
544+
/* 200 OK response from HTTP/1.0 and up without Last-Modified,
545+
* Etag, or Expires headers.
546546
*/
547-
/* XXX mod-include clears last_modified/expires/etags - this
547+
/* Note: mod-include clears last_modified/expires/etags - this
548548
* is why we have an optional function for a key-gen ;-)
549549
*/
550-
reason = "No Last-Modified or Etag header";
550+
reason = "No Last-Modified, Etag, or Expires headers";
551551
}
552552
else if (r->header_only) {
553553
/* HEAD requests */
@@ -723,7 +723,6 @@ static int cache_in_filter(ap_filter_t *f, apr_bucket_brigade *in)
723723
info->request_time = r->request_time;
724724

725725
/* check last-modified date */
726-
/* XXX FIXME we're referencing date on a path where we didn't set it */
727726
if (lastmod != APR_DATE_BAD && lastmod > date) {
728727
/* if it's in the future, then replace by date */
729728
lastmod = date;

0 commit comments

Comments
 (0)