Hi Tillman,
I'm not sure, but it's definitely happening. Here's an example from fetching our beloved logo on the openacs.org site:
$ telnet openacs.org 80
HEAD /templates/slices/openacs.gif HTTP/1.0
HTTP/1.0 200 OK
...snip...
Last-Modified: Tue, 29 Oct 2002 16:41:11 GMT
...snip...
Notice the Last-Modified header.
Then, if I follow it up with an If-Modified-Since and:
$ telnet openacs.org 80
GET /templates/slices/openacs.gif HTTP/1.0
If-Modified-Since: Tue, 29 Oct 2002 16:41:11 GMT
HTTP/1.0 304 Not Modified
This correct behavior is not just limited to URLs which map directly to a file in the file system. cr_write_content, which calls ns_returnfile for static content stored in the file system, seems to also honor the Last-Modified/If-Modified-Since directives, which is a good thing.
And I'm not suggesting to add this *instead* of Cache-Control stuff, since it's already there. I'm suggesting that some people may want to remove all Cache-Control stuff for static content and instead rely on the Last-Modified/If-Modified-Since "protocol", which guarantees freshness along with some measure of efficiency.
Perhaps reasonable default behavior might be:
- At the end of the request, check if there is Last-Modified header. (From what I can tell, this would imply the URL maps to an actual file or is static content being delivered by, say, cr_write_content as described above. It could also have been dynamically added by a script.)
- If one exists, then optionally add a configurable caching directive (30 minutes, 1 hour, whatever), if there are no caching directives already present.
- Otherwise, add the "no cache" stuff, if there are no caching directives already present.
Hope that makes sense...