PR 51714. [Stefan Fritsch, Jim Jagielski, Ruediger Pluem, Eric Covener,
<lowprio20 gmail.com>]
+ *) mod_log_debug: Rename optional argument from if= to expr=, to be more
+ in line with other config directives. [Stefan Fritsch]
+
+ *) mod_headers: Require an expression to be specified with expr=, to be more
+ in line with other config directives. [Stefan Fritsch]
+
*) mod_substitute: To prevent overboarding memory usage, limit line length
to 1MB. [Stefan Fritsch]
<li>
Set a test cookie if and only if the client didn't send us a cookie
<example>
- Header set Set-Cookie testcookie !$req{Cookie}
+ Header set Set-Cookie testcookie "expr=-z %{req:Cookie}"
</example>
</li>
</ol>
<dl>
<dt><code>early</code></dt>
<dd>Specifies <a href="#early">early processing</a>.</dd>
- <dt><code>env=[!]varname</code></dt>
+ <dt><code>env=[!]<var>varname</var></code></dt>
<dd>The directive is applied if and only if the <a href="../env.html"
>environment variable</a> <code>varname</code> exists.
A <code>!</code> in front of <code>varname</code> reverses the test,
so the directive applies only if <code>varname</code> is unset.</dd>
- <dt><code>expr</code></dt>
- <dd>An string that matches neither of the above is parsed as an
- expression. Details of expression syntax and evaluation are
- currently best documented on the <module>mod_filter</module> page.</dd>
+ <dt><code>expr=<var>expression</var></code></dt>
+ <dd>The directive is applied if and only if <var>expression</var>
+ evaluates to true. Details of expression syntax and evaluation are
+ documented in the <a href="../expr.html">ap_expr</a> documentation.</dd>
</dl>
<p>Except in <a href="#early">early</a> mode, the
<dl>
<dt><code>early</code></dt>
<dd>Specifies <a href="#early">early processing</a>.</dd>
- <dt><code>env=[!]varname</code></dt>
+ <dt><code>env=[!]<var>varname</var></code></dt>
<dd>The directive is applied if and only if the <a href="../env.html"
>environment variable</a> <code>varname</code> exists.
A <code>!</code> in front of <code>varname</code> reverses the test,
so the directive applies only if <code>varname</code> is unset.</dd>
- <dt><code>expr</code></dt>
- <dd>An string that matches neither of the above is parsed as an
- expression. Details of expression syntax and evaluation are
- currently best documented on the <module>mod_filter</module> page.</dd>
+ <dt><code>expr=<var>expression</var></code></dt>
+ <dd>The directive is applied if and only if <var>expression</var>
+ evaluates to true. Details of expression syntax and evaluation are
+ documented in the <a href="../expr.html">ap_expr</a> documentation.</dd>
</dl>
<p>Except in <a href="#early">early</a> mode, the
<description>Sets filename and format of log file</description>
<syntax>CustomLog <var>file</var>|<var>pipe</var>
<var>format</var>|<var>nickname</var>
-[env=[!]<var>environment-variable</var>]</syntax>
+[env=[!]<var>environment-variable</var>|
+expr=<var>expression</var>]</syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
</example>
<p>The third argument is optional and controls whether or
- not to log a particular request based on the
- presence or absence of a particular variable in the server
- environment. If the specified <a href="../env.html">environment
- variable</a> is set for the request (or is not set, in the case
- of a '<code>env=!<var>name</var></code>' clause), then the
- request will be logged.</p>
+ not to log a particular request. The condition can be the
+ presence or absence (in the case of a '<code>env=!<var>name</var></code>'
+ clause) of a particular variable in the server
+ <a href="../env.html">environment</a>. Alternatively, the condition
+ can be expressed as arbitrary boolean <a href="../expr.html"
+ >expression</a>. If the condition is not satisfied, the request
+ will not be logged.</p>
<p>Environment variables can be set on a per-request
basis using the <module>mod_setenvif</module>
Log message if request to /foo/* is processed in a sub-request:
<example>
<Location /foo/><br/>
- LogMessage "subrequest to /foo/" hook=type_checker if=%{IS_SUBREQ}<br/>
+ LogMessage "subrequest to /foo/" hook=type_checker expr=%{IS_SUBREQ}<br/>
</Location><br/>
</example>
Log message if an IPv6 client causes a request timeout:
<example>
LogMessage "IPv6 timeout from %{REMOTE_ADDR}"
- "if=-T %{IPV6} && %{REQUEST_STATUS} = 408"
+ "expr=-T %{IPV6} && %{REQUEST_STATUS} = 408"
</example>
- Note the placing of the double quotes for the <code>if=</code> argument.
+ Note the placing of the double quotes for the <code>expr=</code> argument.
</li>
<li>
<description>Log userdefined message to error log
</description>
<syntax>LogMessage <var>message</var>
-[hook=<var>hook</var>] [if=<var>expression</var>]
+[hook=<var>hook</var>] [expr=<var>expression</var>]
</syntax>
<default>Unset</default>
<contextlist><context>directory</context>
return apr_psprintf(cmd->pool, "Invalid hook name: %s", name);
}
}
- else if (strncasecmp(args[i], "if=", 3) == 0) {
- const char *expr = args[i] + 3;
+ else if (strncasecmp(args[i], "expr=", 5) == 0) {
+ const char *expr = args[i] + 5;
entry->condition = ap_expr_parse_cmd(cmd, expr,
AP_EXPR_FLAG_DONT_VARY,
&err, NULL);
}
condition_var = envclause + 4;
}
- else {
+ else if (strncasecmp(envclause, "expr=", 5) == 0) {
const char *err = NULL;
- expr = ap_expr_parse_cmd(cmd, envclause, 0, &err, NULL);
+ expr = ap_expr_parse_cmd(cmd, envclause + 5, 0, &err, NULL);
if (err) {
return apr_pstrcat(cmd->pool,
"Can't parse envclause/expression: ", err,
NULL);
}
}
+ else {
+ return apr_pstrcat(cmd->pool, "Unknown parameter: ", envclause,
+ NULL);
+ }
}
if ((colon = ap_strchr_c(hdr, ':'))) {