Return-Path: Delivered-To: apache-cvs-archive@hyperreal.org Received: (qmail 19342 invoked by uid 6000); 23 Jul 1998 11:34:04 -0000 Received: (qmail 19333 invoked by alias); 23 Jul 1998 11:34:03 -0000 Delivered-To: apache-1.3-cvs@hyperreal.org Received: (qmail 19328 invoked by uid 161); 23 Jul 1998 11:34:02 -0000 Date: 23 Jul 1998 11:34:02 -0000 Message-ID: <19980723113402.19327.qmail@hyperreal.org> From: coar@hyperreal.org To: apache-1.3-cvs@hyperreal.org Subject: cvs commit: apache-1.3/src/modules/standard mod_rewrite.c mod_rewrite.h Sender: apache-cvs-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org coar 98/07/23 04:34:02 Modified: src/modules/standard mod_rewrite.c mod_rewrite.h Log: Add some capability for setting the Vary response field when mod_rewrite makes changes based upon request fields. This is by no means a complete treatment of the problem (redirects don't inherit the Vary at the moment, for instance), but at least we're not ignoring Vary here completely any more. PR: 1644 Reviewed by: Ralf Engelschall Revision Changes Path 1.126 +20 -0 apache-1.3/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.c,v retrieving revision 1.125 retrieving revision 1.126 diff -u -r1.125 -r1.126 --- mod_rewrite.c 1998/07/18 15:30:46 1.125 +++ mod_rewrite.c 1998/07/23 11:34:00 1.126 @@ -1728,6 +1728,7 @@ { char *uri; char *output; + const char *vary; char newuri[MAX_STRING_LEN]; char env[MAX_STRING_LEN]; regex_t *regexp; @@ -1841,6 +1842,7 @@ /* One condition is false, but another can be * still true, so we have to continue... */ + ap_table_unset(r->notes, VARY_KEY_THIS); continue; } else { @@ -1866,13 +1868,30 @@ break; } } + vary = ap_table_get(r->notes, VARY_KEY_THIS); + if (vary != NULL) { + ap_table_merge(r->notes, VARY_KEY, vary); + ap_table_unset(r->notes, VARY_KEY_THIS); + } } /* if any condition fails the complete rule fails */ if (failed) { + ap_table_unset(r->notes, VARY_KEY); + ap_table_unset(r->notes, VARY_KEY_THIS); return 0; } /* + * Regardless of what we do next, we've found a match. Check to see + * if any of the request header fields were involved, and add them + * to the Vary field of the response. + */ + if ((vary = ap_table_get(r->notes, VARY_KEY)) != NULL) { + ap_table_merge(r->headers_out, "Vary", vary); + ap_table_unset(r->notes, VARY_KEY); + } + + /* * If this is a pure matching rule (`RewriteRule -') * we stop processing and return immediately. The only thing * we have not to forget are the environment variables @@ -3718,6 +3737,7 @@ continue; } if (strcasecmp(hdrs[i].key, name) == 0) { + ap_table_merge(r->notes, VARY_KEY_THIS, name); return hdrs[i].val; } } 1.56 +7 -0 apache-1.3/src/modules/standard/mod_rewrite.h Index: mod_rewrite.h =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_rewrite.h,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- mod_rewrite.h 1998/07/13 11:32:46 1.55 +++ mod_rewrite.h 1998/07/23 11:34:01 1.56 @@ -113,6 +113,13 @@ #include "http_log.h" #include "http_vhost.h" + /* + * The key in the r->notes table wherein we store our accumulated + * Vary values, and the one used for per-condition checks in a chain. + */ +#define VARY_KEY "rewrite-Vary" +#define VARY_KEY_THIS "rewrite-Vary-this" + /* The NDBM support: * We support only NDBM files. * But we have to stat the file for the mtime,