explicitely giving a value.
Most modules only check presence of a variable, not the
value, so it makes sense to make the VAL argument in
the mod_rewrite ENV flag optional.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@960233
13f79535-47bb-0310-9956-
ffa450edef68
*) Fix Windows build when using VC6. [Gregg L. Smith <lists glewis com>]
+ *) mod_rewrite: Allow to set environment variables without explicitely
+ giving a value. [Rainer Jung]
+
Changes with Apache 2.3.6
*) SECURITY: CVE-2009-3555 (cve.mitre.org)
...</a></em></td>
</tr>
<tr>
- <td>env|E=<em>VAR</em>:<em>VAL</em></td>
- <td>Causes an environment variable <em>VAR</em> to be set to the
- value <em>VAL</em>. <em><a href="../rewrite/flags.html#flag_e">details ...</a></em></td>
+ <td>env|E=<em>VAR</em>[:<em>VAL</em>]</td>
+ <td>Causes an environment variable <em>VAR</em> to be set (to the
+ value <em>VAL</em> if provided). <em><a href="../rewrite/flags.html#flag_e">details ...</a></em></td>
</tr>
<tr>
<td>forbidden|F</td>
...</a></em></td>
</tr>
<tr>
- <td>env|E=<em>VAR</em>:<em>VAL</em></td>
- <td>Causes an environment variable <em>VAR</em> to be set to the
- value <em>VAL</em>. <em><a
+ <td>env|E=<em>VAR</em>[:<em>VAL</em>]</td>
+ <td>Causes an environment variable <em>VAR</em> to be set (to the
+ value <em>VAL</em> if provided). <em><a
href="../rewrite/flags.html#flag_e">details ...</a></em></td>
</tr>
<tr>
Environment Variables document</a> for more details on how Environment
variables work.</p>
-<p>The syntax for this flag is:</p>
+<p>The full syntax for this flag is:</p>
<div class="example"><p><code>
[E=VAR:VAL]
<p><code>VAL</code> may contain backreferences (<code>$N</code> or
<code>%N</code>) which will be expanded.</p>
-<p>These environment variables can then be used in a variety of
+<p>Using the short form</p>
+
+<div class="example"><p><code>
+[E=VAR]
+</code></p></div>
+
+<p>you can set the environment variable named <code>VAR</code> to an
+empty value.</p>
+
+<p>Environment variables can then be used in a variety of
contexts, including CGI programs, other RewriteRule directives, or
CustomLog directives.</p>
</div><div id="footer">
<p class="apache">Copyright 2010 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
-</body></html>
+</body></html>
\ No newline at end of file
Environment Variables document</a> for more details on how Environment
variables work.</p>
-<p>The syntax for this flag is:</p>
+<p>The full syntax for this flag is:</p>
<example>
[E=VAR:VAL]
<p><code>VAL</code> may contain backreferences (<code>$N</code> or
<code>%N</code>) which will be expanded.</p>
-<p>These environment variables can then be used in a variety of
+<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>Environment variables can then be used in a variety of
contexts, including CGI programs, other RewriteRule directives, or
CustomLog directives.</p>
name = do_expand(env->data, ctx, NULL);
if ((val = ap_strchr(name, ':')) != NULL) {
*val++ = '\0';
-
- apr_table_set(ctx->r->subprocess_env, name, val);
- rewritelog((ctx->r, 5, NULL, "setting env variable '%s' to '%s'",
- name, val));
+ } else {
+ 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;
}