summaryrefslogtreecommitdiffstats
path: root/modules/metadata
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2017-03-09 21:21:19 +0100
committerRuediger Pluem <rpluem@apache.org>2017-03-09 21:21:19 +0100
commit2afa2b45592a259d5acb76ca25e8f6ed95ce57d9 (patch)
tree0f983a4b82ef3bbc6983e18d96d8f804de6d470b /modules/metadata
parent* server/config.c, include/http_config.h (ap_build_cont_config, (diff)
downloadapache2-2afa2b45592a259d5acb76ca25e8f6ed95ce57d9.tar.xz
apache2-2afa2b45592a259d5acb76ca25e8f6ed95ce57d9.zip
* 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1786235 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/metadata')
-rw-r--r--modules/metadata/mod_setenvif.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/metadata/mod_setenvif.c b/modules/metadata/mod_setenvif.c
index c56ef50318..23d60cdba5 100644
--- a/modules/metadata/mod_setenvif.c
+++ b/modules/metadata/mod_setenvif.c
@@ -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) {