]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
*) mod_setenvif: We can have expressions that become true if a regex pattern
authorGraham Leggett <minfrin@apache.org>
Fri, 23 Nov 2018 16:10:51 +0000 (16:10 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 23 Nov 2018 16:10:51 +0000 (16:10 +0000)
   in the expression does NOT match. In this case val is NULL
   and we should just set the value for the environment variable
   like in the pattern case.
+1: jailletc36, jim, minfrin

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

CHANGES
STATUS
modules/metadata/mod_setenvif.c

diff --git a/CHANGES b/CHANGES
index 11e102e1717e0a91519381fa5abb1dcd05987c39..4e1cbb3abe2a998d031232f1dff28fa5f8f00c7b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.38
 
+  *) mod_setenvif: We can have expressions that become true if a regex pattern
+     in the expression does NOT match. In this case val is NULL
+     and we should just set the value for the environment variable 
+     like in the pattern case. [Christophe Jaillet]
+
   *) mod_dav: Fix invalid Location header when a resource is created by
      passing an absolute URI on the request line [Jim Jagielski]
 
diff --git a/STATUS b/STATUS
index af0aafc9e38fb4533446d3ae3b02fa9b9aef37ff..e78976bd5f30ab2a56f3ceff743c7c5f087eb318 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -126,15 +126,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_setenvif:  We can have expressions that become true if a regex pattern
-                    in the expression does NOT match. In this case val is NULL
-                    and we should just set the value for the environment variable
-                    like in the pattern case.
-     trunk patch: http://svn.apache.org/r1786235
-     2.4.x patch: svn merge -c 1786235 ^/httpd/httpd/trunk .
-     +1: jailletc36, jim, minfrin
-     jailletc36: Test-case added in r1845094
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index c56ef503187723f558325fa4cb0843d0912a02be..23d60cdba5ac81a357c421b024a0e7a5ccc4a8ba 100644 (file)
@@ -597,7 +597,17 @@ static int match_headers(request_rec *r)
                     apr_table_unset(r->subprocess_env, elts[j].key);
                 }
                 else {
-                    if (!b->pattern) {
+                    /*
+                     * Do regex replacement, if we did not use a pattern, so
+                     * either a regex or an expression and if we have a val
+                     * or at least we did not use an expression.
+                     * Background: We can have expressions that become true
+                     * if a regex pattern in the expression does NOT match.
+                     * In this case val is NULL and we should just set the
+                     * value for the environment variable like in the pattern
+                     * case.
+                     */
+                    if (!b->pattern && (val || !b->expr)) {
                         char *replaced = ap_pregsub(r->pool, elts[j].val, val,
                                                     AP_MAX_REG_MATCH, regm);
                         if (replaced) {