Commit feec1c1f authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Unify syntax of config directives taking an expression as optional contition argument


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1197413 13f79535-47bb-0310-9956-ffa450edef68
parent 3b58006e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,12 @@ Changes with Apache 2.3.15
     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]

+11 −11
Original line number Diff line number Diff line
@@ -184,7 +184,7 @@ headers</description>
      <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>
@@ -273,15 +273,15 @@ headers</description>
    <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
@@ -447,15 +447,15 @@ headers</description>
    <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
+9 −7
Original line number Diff line number Diff line
@@ -388,7 +388,8 @@
<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>

@@ -445,12 +446,13 @@
    </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>
+4 −4
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
        Log message if request to /foo/* is processed in a sub-request:
        <example>
            &lt;Location /foo/&gt;<br/>
            &nbsp;&nbsp;LogMessage "subrequest to /foo/" hook=type_checker if=%{IS_SUBREQ}<br/>
            &nbsp;&nbsp;LogMessage "subrequest to /foo/" hook=type_checker expr=%{IS_SUBREQ}<br/>
            &lt;/Location&gt;<br/>
        </example>

@@ -59,9 +59,9 @@
        Log message if an IPv6 client causes a request timeout:
        <example>
            LogMessage "IPv6 timeout from %{REMOTE_ADDR}"
              "if=-T %{IPV6} &amp;&amp; %{REQUEST_STATUS} = 408"
              "expr=-T %{IPV6} &amp;&amp; %{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>
@@ -85,7 +85,7 @@
<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>
+2 −2
Original line number Diff line number Diff line
@@ -221,8 +221,8 @@ static const char *cmd_log_message(cmd_parms *cmd, void *dconf_, const char *arg
                    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);
Loading