]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r960233 from trunk:
authorRainer Jung <rjung@apache.org>
Fri, 16 Jul 2010 10:36:21 +0000 (10:36 +0000)
committerRainer Jung <rjung@apache.org>
Fri, 16 Jul 2010 10:36:21 +0000 (10:36 +0000)
mod_rewrite: Allow to set environment variables without
explicitely giving a value.

Before this patch using [ENV=VAR] instead of [ENV=VAR:VAL]
silently drops the flag (it is added to the list of vars to set,
but then never actually set).

Submitted by: rjung
Reviewed by: rjung, niq, rpluem

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@964741 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/mod/mod_rewrite.html.en
docs/manual/mod/mod_rewrite.xml
modules/mappers/mod_rewrite.c

diff --git a/CHANGES b/CHANGES
index 5c1dcff3066622e97b631fcc409459d332eeb648..3d7aa1b67fee2e1a8ec8a957fb6edf508bffa071 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -25,6 +25,9 @@ Changes with Apache 2.2.16
      an action to happen when a URL maps to no file, without resorting
      to ErrorDocument or mod_rewrite.  PR 47184 [Nick Kew]
 
+  *) mod_rewrite: Allow to set environment variables without explicitely
+     giving a value. [Rainer Jung]
+
 
 Changes with Apache 2.2.15
 
diff --git a/STATUS b/STATUS
index 9f25c05db9e6fcff49f076e368d04c640870a5be..ce5d6398e322d5ca892d9733ce518308e8bd6560 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -86,17 +86,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_rewrite: Allow to set environment variables using mod_rewrite without
-     explicitely giving a value.
-     Most modules only check presence of a variable, not the value, so it makes
-     sense to make the VAL argument in the mod_rewrite ENV flag optional.
-     Currently using [ENV=VAR] instead of [ENV=VAR:VAL] silently drops the flag
-     (it is added to the list of vars to set, but then never actually set).
-     Trunk version of patch:
-        http://svn.apache.org/viewvc?rev=960233&view=rev
-     Backport version for 2.2.x of patch:
-        http://people.apache.org/~rjung/patches/httpd-branch-2.2-mod_rewrite-env_var-emptyvalue.patch
-     +1: rjung, niq, rpluem
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 14c881e6fe40c6f975d43593273a22b301420f42..d6fea7b3d535aaef5a872cbaa23f49605a96593a 100644 (file)
@@ -1283,11 +1283,11 @@ cannot use <code>$N</code> in the substitution string!
         appended.</p></dd>
 
         <dt>
-        '<code>env|E=</code><em>VAR</em>:<em>VAL</em>'
+        '<code>env|E=</code><em>VAR</em>[:<em>VAL</em>]'
         (set environment variable)</dt><dd>
         This forces an environment variable named <em>VAR</em> to
-        be set to the value <em>VAL</em>, where <em>VAL</em> can
-        contain regexp backreferences (<code>$N</code> and
+        be set. The value will be <em>VAL</em> if provided, where <em>VAL</em>
+        can contain regexp backreferences (<code>$N</code> and
         <code>%N</code>) which will be expanded. You can use this
         flag more than once, to set more than one variable. The
         variables can later be dereferenced in many situations, most commonly
index d178b1115ca7748715271ea00a297f6616382fba..a9147b96e08eb8079ca3982085c8e86acf3f02ea 100644 (file)
@@ -1298,11 +1298,11 @@ cannot use <code>$N</code> in the substitution string!
         appended.</p></dd>
 
         <dt>
-        '<code>env|E=</code><em>VAR</em>:<em>VAL</em>'
+        '<code>env|E=</code><em>VAR</em>[:<em>VAL</em>]'
         (set environment variable)</dt><dd>
         This forces an environment variable named <em>VAR</em> to
-        be set to the value <em>VAL</em>, where <em>VAL</em> can
-        contain regexp backreferences (<code>$N</code> and
+        be set. The value will be <em>VAL</em> if provided, where <em>VAL</em>
+        can contain regexp backreferences (<code>$N</code> and
         <code>%N</code>) which will be expanded. You can use this
         flag more than once, to set more than one variable. The
         variables can later be dereferenced in many situations, most commonly
index fd293e2673e1c59fe83574480cdf6571a3934383..5b58f5b39da3aa0b1a8ccdf7c60a277347120dfe 100644 (file)
@@ -2349,12 +2349,14 @@ static void do_expand_env(data_item *env, rewrite_ctx *ctx)
         name = do_expand(env->data, ctx, NULL);
         if ((val = ap_strchr(name, ':')) != NULL) {
             *val++ = '\0';
-
-            apr_table_set(ctx->r->subprocess_env, name, val);
-            rewritelog((ctx->r, 5, NULL, "setting env variable '%s' to '%s'",
-                        name, val));
+        } else {
+            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;
     }