You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2007/09/11 22:15:55 UTC
svn commit: r574684 - in /httpd/httpd/trunk: CHANGES
docs/manual/mod/mod_rewrite.xml modules/mappers/mod_rewrite.c
Author: rpluem
Date: Tue Sep 11 13:15:54 2007
New Revision: 574684
URL: http://svn.apache.org/viewvc?rev=574684&view=rev
Log:
* Add the novary flag to RewriteCond in order to prevent the appending
of HTTP headers used in a rewrite condition to the Vary header of
the response.
Modified:
httpd/httpd/trunk/CHANGES
httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
httpd/httpd/trunk/modules/mappers/mod_rewrite.c
Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=574684&r1=574683&r2=574684&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Tue Sep 11 13:15:54 2007
@@ -2,6 +2,9 @@
Changes with Apache 2.3.0
[ When backported to 2.2.x, remove entry from this file ]
+ *) mod_rewrite: Add the novary flag to RewriteCond.
+ [Ruediger Pluem]
+
*) Don't send spurious "100 Continue" response lines.
PR 38014 [Basant Kumar Kukreja <basant.kukreja sun.com>]
Modified: httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml?rev=574684&r1=574683&r2=574684&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Tue Sep 11 13:15:54 2007
@@ -848,7 +848,15 @@
value of a header sent in the HTTP request.
Example: <code>%{HTTP:Proxy-Connection}</code> is
the value of the HTTP header
- ``<code>Proxy-Connection:</code>''.</li>
+ ``<code>Proxy-Connection:</code>''.
+ <p>If a HTTP header is used in a condition this header is added to
+ the Vary header of the response in case the condition evaluates to
+ to true for the request. It is <strong>not</strong> added if the
+ condition evaluates to false for the request. Adding the HTTP header
+ to the Vary header of the response is needed for proper caching.</p>
+ <p>It has to be kept in mind that conditions follow a short circuit
+ logic in the case of the '<strong><code>ornext|OR</code></strong>' flag
+ so that certain conditions might not be evaluated at all.</p></li>
<li>
<code>%{LA-U:variable}</code> can be used for look-aheads which perform
@@ -1007,6 +1015,16 @@
Without this flag you would have to write the condition/rule
pair three times.
+ </li>
+
+ <li>'<strong><code>novary|NV</code></strong>'
+ (<strong>n</strong>o <strong>v</strong>ary)<br />
+ If a HTTP header is used in the condition, this flag prevents
+ this header from being added to the Vary header of the response. <br />
+ Using this flag might break proper caching of the response if
+ the representation of this response varies on the value of this header.
+ So this flag should be only used if the meaning of the Vary header
+ is well understood.
</li>
</ul>
</li>
Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=574684&r1=574683&r2=574684&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Tue Sep 11 13:15:54 2007
@@ -135,6 +135,7 @@
#define CONDFLAG_NOCASE 1<<1
#define CONDFLAG_NOTMATCH 1<<2
#define CONDFLAG_ORNEXT 1<<3
+#define CONDFLAG_NOVARY 1<<4
#define RULEFLAG_NONE 1<<0
#define RULEFLAG_FORCEREDIRECT 1<<1
@@ -3207,6 +3208,10 @@
|| strcasecmp(key, "OR") == 0 ) {
cfg->flags |= CONDFLAG_ORNEXT;
}
+ else if ( strcasecmp(key, "novary") == 0
+ || strcasecmp(key, "NV") == 0 ) {
+ cfg->flags |= CONDFLAG_NOVARY;
+ }
else {
return apr_pstrcat(p, "RewriteCond: unknown flag '", key, "'", NULL);
}
@@ -3908,6 +3913,12 @@
rewritecond_entry *c = &conds[i];
rc = apply_rewrite_cond(c, ctx);
+ /*
+ * Reset vary_this if the novary flag is set for this condition.
+ */
+ if (c->flags & CONDFLAG_NOVARY) {
+ ctx->vary_this = NULL;
+ }
if (c->flags & CONDFLAG_ORNEXT) {
if (!rc) {
/* One condition is false, but another can be still true. */