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 2017/03/09 20:21:20 UTC

svn commit: r1786235 - /httpd/httpd/trunk/modules/metadata/mod_setenvif.c

Author: rpluem
Date: Thu Mar  9 20:21:19 2017
New Revision: 1786235

URL: http://svn.apache.org/viewvc?rev=1786235&view=rev
Log:
* 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.

Modified:
    httpd/httpd/trunk/modules/metadata/mod_setenvif.c

Modified: httpd/httpd/trunk/modules/metadata/mod_setenvif.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_setenvif.c?rev=1786235&r1=1786234&r2=1786235&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_setenvif.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_setenvif.c Thu Mar  9 20:21:19 2017
@@ -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) {