httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1197413 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_headers.xml docs/manual/mod/mod_log_config.xml docs/manual/mod/mod_log_debug.xml modules/loggers/mod_log_debug.c modules/metadata/mod_headers.c
Date Fri, 04 Nov 2011 07:27:08 GMT
Author: sf
Date: Fri Nov  4 07:27:07 2011
New Revision: 1197413

URL: http://svn.apache.org/viewvc?rev=1197413&view=rev
Log:
Unify syntax of config directives taking an expression as optional contition argument

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
    httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
    httpd/httpd/trunk/docs/manual/mod/mod_log_debug.xml
    httpd/httpd/trunk/modules/loggers/mod_log_debug.c
    httpd/httpd/trunk/modules/metadata/mod_headers.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri Nov  4 07:27:07 2011
@@ -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]
 

Modified: httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_headers.xml?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_headers.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_headers.xml Fri Nov  4 07:27:07 2011
@@ -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

Modified: httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_log_config.xml Fri Nov  4 07:27:07 2011
@@ -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>

Modified: httpd/httpd/trunk/docs/manual/mod/mod_log_debug.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_log_debug.xml?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_log_debug.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_log_debug.xml Fri Nov  4 07:27:07 2011
@@ -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>

Modified: httpd/httpd/trunk/modules/loggers/mod_log_debug.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_log_debug.c?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_log_debug.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_log_debug.c Fri Nov  4 07:27:07 2011
@@ -221,8 +221,8 @@ static const char *cmd_log_message(cmd_p
                     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);

Modified: httpd/httpd/trunk/modules/metadata/mod_headers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_headers.c?rev=1197413&r1=1197412&r2=1197413&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_headers.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_headers.c Fri Nov  4 07:27:07 2011
@@ -490,15 +490,19 @@ static APR_INLINE const char *header_ino
             }
             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, ':'))) {



Mime
View raw message