-*- coding: utf-8 -*-
Changes with Apache 2.2.18
+ *) mod_rewrite: Allow to unset environment variables. PR 50746.
+ [Rainer Jung]
+
*) suEXEC: Add Suexec directive to disable suEXEC without renaming the
binary (Suexec Off), or force startup failure if suEXEC is required
but not supported (Suexec On). [Jeff Trawick]
-
+
*) mod_proxy: Put the worker in error state if the SSL handshake with the
backend fails. PR 50332.
[Daniel Ruggeri <DRuggeri primary.net>, Ruediger Pluem]
Non-optional broken features are worse :)
Trunk must be patched identically.
- * mod_rewrite: Allow to unset environment variables.
- Direct backport from trunk.
- PR: 50746
- 2.2.x patch: https://issues.apache.org/bugzilla/attachment.cgi?id=26646
- (patch is simpler if viewed with whitespace changes ignored)
- +1 rjung, covener, rpluem
- (needs doc too including the behavior change in 2.2.16)
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
only the direct result of substitutions, without any PATH_INFO
appended.</p></dd>
- <dt>
- '<code>env|E=</code><em>VAR</em>[:<em>VAL</em>]'
+ <dt>'<code>env|E=!</code><em>VAR</em>[:<em>VAL</em>]'
(set environment variable)</dt><dd>
This forces an environment variable named <em>VAR</em> to
be set. The value will be <em>VAL</em> if provided, where <em>VAL</em>
can contain regexp backreferences (<code>$N</code> and
- <code>%N</code>) which will be expanded. You can use this
- flag more than once, to set more than one variable. The
- variables can later be dereferenced in many situations, most commonly
- from within XSSI (via <code><!--#echo
+ <code>%N</code>) which will be expanded. The form !<em>VAR</em> causes
+ the environment variable <em>VAR</em> to be unset and does not accept
+ any <em>VAL</em>. You can use this flag more than once, to set more
+ than one variable. The variables can later be dereferenced in many
+ situations, most commonly from within XSSI (via <code><!--#echo
var="VAR"--></code>) or CGI (<code>$ENV{'VAR'}</code>).
You can also dereference the variable in a later RewriteCond pattern, using
<code>%{ENV:VAR}</code>. Use this to strip
Environment Variables document</a> for more details on how Environment
variables work.</p>
-<p>The following example sets an evironment variable called 'image' to a
+<p>The full syntax for this flag is:</p>
+
+<example>
+[E=VAR:VAL]
+[E=!VAR]
+</example>
+
+<p><code>VAL</code> may contain backreferences (<code>$N</code> or
+<code>%N</code>) which will be expanded.</p>
+
+<p>Using the short form</p>
+
+<example>
+[E=VAR]
+</example>
+
+<p>you can set the environment variable named <code>VAR</code> to an
+empty value.</p>
+
+<p>The form</p>
+
+<example>
+[E=!VAR]
+</example>
+
+<p>allows to unset a previously set environment variable named
+<code>VAR</code>.</p>
+
+<p>Environment variables can then be used in a variety of
+contexts, including CGI programs, other RewriteRule directives, or
+CustomLog directives.</p>
+
+<p>The following example sets an environment variable called 'image' to a
value of '1' if the requested URI is an image file. Then, that
environment variable is used to exclude those requests from the access
log.</p>
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;
}