Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 39193 invoked from network); 29 Dec 2010 20:42:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Dec 2010 20:42:17 -0000 Received: (qmail 19679 invoked by uid 500); 29 Dec 2010 20:42:17 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 19606 invoked by uid 500); 29 Dec 2010 20:42:16 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 19599 invoked by uid 99); 29 Dec 2010 20:42:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Dec 2010 20:42:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Dec 2010 20:42:16 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CE90B2388903; Wed, 29 Dec 2010 20:41:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1053726 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_rewrite.xml docs/manual/rewrite/flags.xml modules/mappers/mod_rewrite.c Date: Wed, 29 Dec 2010 20:41:55 -0000 To: cvs@httpd.apache.org From: sf@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101229204155.CE90B2388903@eris.apache.org> Author: sf Date: Wed Dec 29 20:41:55 2010 New Revision: 1053726 URL: http://svn.apache.org/viewvc?rev=1053726&view=rev Log: Allow to unset environment variables using E=!VAR. PR: 49512 Submitted by: Mark Drayton , Stefan Fritsch Modified: httpd/httpd/trunk/CHANGES httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml httpd/httpd/trunk/docs/manual/rewrite/flags.xml httpd/httpd/trunk/modules/mappers/mod_rewrite.c Modified: httpd/httpd/trunk/CHANGES URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1053726&r1=1053725&r2=1053726&view=diff ============================================================================== --- httpd/httpd/trunk/CHANGES [utf-8] (original) +++ httpd/httpd/trunk/CHANGES [utf-8] Wed Dec 29 20:41:55 2010 @@ -2,6 +2,9 @@ Changes with Apache 2.3.11 + *) mod_rewrite: Allow to unset environment variables using E=!VAR. + PR 49512. [Mark Drayton , Stefan Fritsch] + *) mod_headers: Restore the 2.3.8 and earlier default for the first argument of the Header directive ("onsuccess"). [Eric Covener] Modified: httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml?rev=1053726&r1=1053725&r2=1053726&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml (original) +++ httpd/httpd/trunk/docs/manual/mod/mod_rewrite.xml Wed Dec 29 20:41:55 2010 @@ -1036,9 +1036,10 @@ cannot use $N in the substi ... - env|E=VAR[:VAL] + env|E=[!]VAR[:VAL] Causes an environment variable VAR to be set (to the - value VAL if provided). VAL if provided). The form !VAR causes + the environment variable VAR to be unset.details ... Modified: httpd/httpd/trunk/docs/manual/rewrite/flags.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/flags.xml?rev=1053726&r1=1053725&r2=1053726&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/flags.xml (original) +++ httpd/httpd/trunk/docs/manual/rewrite/flags.xml Wed Dec 29 20:41:55 2010 @@ -212,6 +212,7 @@ variables work.

[E=VAR:VAL] +[E=!VAR]

VAL may contain backreferences ($N or @@ -226,6 +227,15 @@ variables work.

you can set the environment variable named VAR to an empty value.

+

The form

+ + +[E=!VAR] + + +

allows to unset a previouslz set environment variable named +VAR.

+

Environment variables can then be used in a variety of contexts, including CGI programs, other RewriteRule directives, or CustomLog directives.

Modified: httpd/httpd/trunk/modules/mappers/mod_rewrite.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1053726&r1=1053725&r2=1053726&view=diff ============================================================================== --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original) +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Wed Dec 29 20:41:55 2010 @@ -2408,15 +2408,22 @@ static void do_expand_env(data_item *env 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; }