httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1053726 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_rewrite.xml docs/manual/rewrite/flags.xml modules/mappers/mod_rewrite.c
Date Wed, 29 Dec 2010 20:41:55 GMT
Author: sf
Date: Wed Dec 29 20:41:55 2010
New Revision: 1053726

URL: http://svn.apache.org/viewvc?rev=1053726&view=rev
Log:
Allow to unset environment variables using E=!VAR.

PR: 49512
Submitted by: Mark Drayton <mark markdrayton info>, Stefan Fritsch

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml
    httpd/httpd/trunk/docs/manual/rewrite/flags.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=1053726&r1=1053725&r2=1053726&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Dec 29 20:41:55 2010
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.3.11
 
+  *) mod_rewrite: Allow to unset environment variables using E=!VAR.
+     PR 49512. [Mark Drayton <mark markdrayton info>, Stefan Fritsch]
+
   *) mod_headers: Restore the 2.3.8 and earlier default for the first 
      argument of the Header directive ("onsuccess").  [Eric Covener]
 

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=1053726&r1=1053725&r2=1053726&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Wed Dec 29 20:41:55 2010
@@ -1036,9 +1036,10 @@ cannot use <code>$N</code> in the substi
         ...</a></em></td>
     </tr>
     <tr>
-        <td>env|E=<em>VAR</em>[:<em>VAL</em>]</td>
+        <td>env|E=[!]<em>VAR</em>[:<em>VAL</em>]</td>
         <td>Causes an environment variable <em>VAR</em> to be set (to the
-        value <em>VAL</em> if provided). <em><a
+        value <em>VAL</em> if provided). The form !<em>VAR</em> causes
+        the environment variable <em>VAR</em> to be unset.<em><a
         href="../rewrite/flags.html#flag_e">details ...</a></em></td>
     </tr>
     <tr>

Modified: httpd/httpd/trunk/docs/manual/rewrite/flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/flags.xml?rev=1053726&r1=1053725&r2=1053726&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/flags.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/flags.xml Wed Dec 29 20:41:55 2010
@@ -212,6 +212,7 @@ variables work.</p>
 
 <example>
 [E=VAR:VAL]
+[E=!VAR]
 </example>
 
 <p><code>VAL</code> may contain backreferences (<code>$N</code>
or
@@ -226,6 +227,15 @@ variables work.</p>
 <p>you can set the environment variable named <code>VAR</code> to an
 empty value.</p>
 
+<p>The form</p>
+
+<example>
+[E=!VAR]
+</example>
+
+<p>allows to unset a previouslz set environment variable named
+<code>VAR</code>.</p>
+
 <p>Environment variables can then be used in a variety of
 contexts, including CGI programs, other RewriteRule directives, or
 CustomLog directives.</p>

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1053726&r1=1053725&r2=1053726&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Wed Dec 29 20:41:55 2010
@@ -2408,15 +2408,22 @@ static void do_expand_env(data_item *env
 
     while (env) {
         name = do_expand(env->data, ctx, NULL);
-        if ((val = ap_strchr(name, ':')) != NULL) {
-            *val++ = '\0';
-        } else {
-            val = "";
+        if (*name == '!') {
+            name++;
+            apr_table_unset(ctx->r->subprocess_env, name);
+            rewritelog((ctx->r, 5, NULL, "unsetting env variable '%s'", name));
         }
+        else {
+            if ((val = ap_strchr(name, ':')) != NULL) {
+                *val++ = '\0';
+            } else {
+                val = "";
+            }
 
-        apr_table_set(ctx->r->subprocess_env, name, val);
-        rewritelog((ctx->r, 5, NULL, "setting env variable '%s' to '%s'",
-                    name, val));
+            apr_table_set(ctx->r->subprocess_env, name, val);
+            rewritelog((ctx->r, 5, NULL, "setting env variable '%s' to '%s'",
+                        name, val));
+        }
 
         env = env->next;
     }



Mime
View raw message