Bug 19441 - cache ignores no-cache request directive
Summary: cache ignores no-cache request directive
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache (show other bugs)
Version: 2.0-HEAD
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://coad.measurement-factory.com/c...
Keywords: PatchAvailable
: 16136 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-29 20:36 UTC by Co-Advisor
Modified: 2008-01-08 23:48 UTC (History)
0 users



Attachments
no-cache test case trace (violation) (13.05 KB, text/html)
2003-04-29 20:37 UTC, Co-Advisor
Details
pragma test case trace (success) (14.40 KB, text/html)
2003-04-29 20:39 UTC, Co-Advisor
Details
Patch against 2.0.54 (2.01 KB, patch)
2007-02-16 02:57 UTC, Axel-Stephane Smorgrav
Details | Diff
Patch against 2.0.59 (1.32 KB, patch)
2007-07-25 04:28 UTC, Axel-Stephane Smorgrav
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Co-Advisor 2003-04-29 20:36:19 UTC
Looks like a possible RFC 2616 MUST violation. The cache
ignores no-cache cache-control directive in the request
and serves cached entity.

Note that Pragma: no-cache is handled correctly (trace attached),
which may be related to a committed patch mentioned in bug 18634.

See attached trace(s) for details and ways to reproduce
the violation mentioned above.

Test case IDs in the trace link to human-oriented test case
description and RFC quotes, if available.
Comment 1 Co-Advisor 2003-04-29 20:37:19 UTC
Created attachment 6082 [details]
no-cache test case trace (violation)
Comment 2 Co-Advisor 2003-04-29 20:39:08 UTC
Created attachment 6083 [details]
pragma test case trace (success)
Comment 3 Co-Advisor 2005-06-06 21:05:18 UTC
FYI: This violation seems to be present in httpd-2.0.54
Comment 4 Carles G 2006-09-05 15:34:13 UTC
FYI: This violation seems to be present in httpd-2.0.59

  HTTP/1.1 200 OK
  Date: Tue, 05 Sep 2006 13:37:12 GMT
  Server: Apache/2.0.59 (Unix)
  Content-Type: text/html;charset=iso-8859-1
  Last-Modified: Tue, 05 Sep 2006 13:08:17 GMT
  Content-Length: 36709
  Content-Language: es
  Expires: Sat, 1 Jan 2000 00:00:00 GMT
  Pragma: no-cache
  Age: 1735
  Keep-Alive: timeout=30, max=500
  Connection: Keep-Alive
Longitud: 36,709 (36K) [text/html]
Comment 5 Ruediger Pluem 2006-09-05 20:22:41 UTC
Please note that mod_cache is experimental in 2.0.x. Please check if this bug is
still present in 2.2.3 which has many caching fixes.
Comment 6 Axel-Stephane Smorgrav 2007-02-08 01:40:06 UTC
Not only does Apache 2.0 ignore the no-cache Cache-Control directive in
requests, it ignores the presence of the Cache-Control request header altogether.

The no-cache directive in requests is not taken into account in mod_cache.c at all.

cache_util.c ap_cache_check_freshness() does make a fair attempt at determining
freshness of a cached response and take the Cache-Control request header
directives into account. However, it seems like the request_rec structured
passed to the function does not contain the Cache-Control header.

I think I may provide a fix for both issues.
Comment 7 Axel-Stephane Smorgrav 2007-02-16 02:57:50 UTC
Created attachment 19601 [details]
Patch against 2.0.54
Comment 8 Axel-Stephane Smorgrav 2007-02-16 11:21:18 UTC
I submitted a patch against 2.0.54. 
I however believe that requests containing an Authorization header should be
treated separately from those containing no-cache directives (ref bug 16133), so
this patch is not fully satisfactory.
Comment 9 Axel-Stephane Smorgrav 2007-07-25 04:28:39 UTC
Created attachment 20547 [details]
Patch against 2.0.59

This is a new patch against 2.0.59 that also permits end-to-end revalidation of
cached responses when the request contains Cache-Control: no-cache. Previous
patch did not allow for updating cache contents.
Comment 10 Axel-Stephane Smorgrav 2007-07-30 23:41:07 UTC
(In reply to comment #5)
> Please note that mod_cache is experimental in 2.0.x. Please check if this bug is
> still present in 2.2.3 which has many caching fixes.

This bug is no longer present in 2.2.4
Comment 11 Axel-Stephane Smorgrav 2007-08-06 01:52:19 UTC
I guess that since I already established that the bug is no longer present in
2.2.4, it no longer needs to remain in NEEDINFO status...
Comment 12 Ruediger Pluem 2007-08-06 08:58:40 UTC
Marking as resolved worksforme then. As Cache is experimental 2.0.x it is
unlikely that it gets backported to 2.0.x.
Comment 13 Axel-Stephane Smorgrav 2007-08-22 23:35:29 UTC
(In reply to comment #12)
> Marking as resolved worksforme then. As Cache is experimental 2.0.x it is
> unlikely that it gets backported to 2.0.x.

I was just answering your question from #5 which I understood was the reason for
the NEEDINFO status.

The patch I submitted solves this problem for 2.0.x. For those of us who use
mod_cache and cannot for one reason or another (in my case dependencies to 3pp
modules) migrate to 2.2.x, it would be nice if it could make it into for example
2.0.62...
Comment 14 Axel-Stephane Smorgrav 2008-01-08 23:48:26 UTC
*** Bug 16136 has been marked as a duplicate of this bug. ***