summaryrefslogtreecommitdiffstats
path: root/modules/mappers
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2010-12-29 21:41:55 +0100
committerStefan Fritsch <sf@apache.org>2010-12-29 21:41:55 +0100
commit7f6106542e5ec3aec4c85f4cdb8777a8cdb29510 (patch)
tree371264fa5a44298bac94a1089b639416366da880 /modules/mappers
parentIn comments: s@ XX @ XXX: @ so they can actually be found seen. (diff)
downloadapache2-7f6106542e5ec3aec4c85f4cdb8777a8cdb29510.tar.xz
apache2-7f6106542e5ec3aec4c85f4cdb8777a8cdb29510.zip
Allow to unset environment variables using E=!VAR.
PR: 49512 Submitted by: Mark Drayton <mark markdrayton info>, Stefan Fritsch git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053726 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/mappers')
-rw-r--r--modules/mappers/mod_rewrite.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c
index 44ff0b46cc..2571e2ca84 100644
--- a/modules/mappers/mod_rewrite.c
+++ b/modules/mappers/mod_rewrite.c
@@ -2408,15 +2408,22 @@ static void do_expand_env(data_item *env, rewrite_ctx *ctx)
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;
}