pcs 97/08/23 07:20:36
Modified: src/modules/standard mod_negotiation.c
Log:
mod_negotiation marks *all* responses
(HTTP/1.0) browsers and proxies caching one variant which may not be the
correct one for subsequent requests. The issue is that if you are using
mod_negotiation in a trivial way to map (say) requests for index onto
index.html *with no other variants*, Apache makes your responses
non-cacheable when they probably are safely cacheable.
This patch makes responses from mod_negotiation cacheable in the following
circumstances:
* Variants are found by multiviews (i.e. looking on the disk, rather
than reading a .var file) AND
* there was only one matching variant found on disk AND
* request version is HTTP/1.0 or earlier
Reviewed By: Roy Fielding, Dean Gaudet
Revision Changes Path
1.55 +9 -1 apachen/src/modules/standard/mod_negotiation.c
Index: mod_negotiation.c
===================================================================
RCS file: /export/home/cvs/apachen/src/modules/standard/mod_negotiation.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- mod_negotiation.c 1997/08/18 13:12:16 1.54
+++ mod_negotiation.c 1997/08/23 14:20:35 1.55
@@ -227,6 +227,8 @@
array_header *accept_langs; /* accept_recs */
array_header *avail_vars; /* available variants */
+ int count_multiviews_variants; /* number of variants found on disk */
+
int ua_can_negotiate; /* 1 if ua can do transparent negotiate */
int use_transparent_neg; /* 1 if we are using transparent neg */
int short_accept_headers; /* 1 if ua does trans neg & sent short accpt
*/
@@ -649,6 +651,9 @@
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;
+
+ /* We are not using multiviews */
+ neg->count_multiviews_variants = 0;
if (rr->status != HTTP_OK) {
return rr->status;
@@ -809,6 +814,8 @@
new_var = push_array (neg->avail_vars);
memcpy (new_var, (void *)&mime_info, sizeof (var_rec));
+
+ neg->count_multiviews_variants++;
clean_var_rec(&mime_info);
}
@@ -1994,7 +2001,8 @@
/* Otherwise, use it. */
- if (!do_cache_negotiated_docs(r->server) && (r->proto_num < 1001))
+ if ((!do_cache_negotiated_docs(r->server) && (r->proto_num < 1001))
+ && neg->count_multiviews_variants != 1)
r->no_cache = 1;
if (na_result == na_not_applied)