httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1212884 - in /httpd/httpd/branches/2.4.x: ./ docs/manual/expr.xml server/util_expr_eval.c
Date Sat, 10 Dec 2011 21:27:22 GMT
Author: sf
Date: Sat Dec 10 21:27:22 2011
New Revision: 1212884

URL: http://svn.apache.org/viewvc?rev=1212884&view=rev
Log:
Merge r1212883:
Fix names of unary operators like '-s' being compared case insensitively.
Improve error message if op or function is not found. Document '-s' operator.

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/docs/manual/expr.xml
    httpd/httpd/branches/2.4.x/server/util_expr_eval.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Dec 10 21:27:22 2011
@@ -1,3 +1,3 @@
 /httpd/httpd/branches/revert-ap-ldap:1150158-1150173
 /httpd/httpd/branches/wombat-integration:723609-723841
-/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202236,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1206850,1207719,1208753,1208835,1209053,1209085,1209417,1209432,1209461,1209601,1209603,1209618,1209623,1209741,1209754,1209766,1209776,1209797-1209798,1209811-1209812,1209814,1209908,1209910,1209913,1209916-1209917,1209947,1209952,1210080,1210124,1210130,1210219,1210221,1210252,1210284,1210378,1210725,1210892,1210951,1210954,1211528,1211663,1211680
+/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202236,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1206850,1207719,1208753,1208835,1209053,1209085,1209417,1209432,1209461,1209601,1209603,1209618,1209623,1209741,1209754,1209766,1209776,1209797-1209798,1209811-1209812,1209814,1209908,1209910,1209913,1209916-1209917,1209947,1209952,1210080,1210124,1210130,1210219,1210221,1210252,1210284,1210378,1210725,1210892,1210951,1210954,1211528,1211663,1211680,1212883

Modified: httpd/httpd/branches/2.4.x/docs/manual/expr.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/expr.xml?rev=1212884&r1=1212883&r2=1212884&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/expr.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/expr.xml Sat Dec 10 21:27:22 2011
@@ -374,6 +374,9 @@ listfunction ::= listfuncname "<strong>(
     <tr><td><code>-f</code></td>
         <td>The argument is treated as a filename.
             True if the file exists and is regular file</td><td>yes</td></tr>
+    <tr><td><code>-s</code></td>
+        <td>The argument is treated as a filename.
+            True if the file exists and is not empty</td><td>yes</td></tr>
     <tr><td><code>-L</code></td>
         <td>The argument is treated as a filename.
             True if the file exists and is symlink</td><td>yes</td></tr>

Modified: httpd/httpd/branches/2.4.x/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/util_expr_eval.c?rev=1212884&r1=1212883&r2=1212884&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/util_expr_eval.c (original)
+++ httpd/httpd/branches/2.4.x/server/util_expr_eval.c Sat Dec 10 21:27:22 2011
@@ -1636,7 +1636,12 @@ static int core_expr_lookup(ap_expr_look
                 ap_assert(0);
             }
             while (prov->func) {
-                if (strcasecmp(prov->name, parms->name) == 0) {
+                int match;
+                if (parms->type == AP_EXPR_FUNC_OP_UNARY)
+                    match = !strcmp(prov->name, parms->name);
+                else
+                    match = !strcasecmp(prov->name, parms->name);
+                if (match) {
                     if ((parms->flags & AP_EXPR_FLAG_RESTRICTED)
                         && prov->restricted) {
                         *parms->err =
@@ -1668,6 +1673,7 @@ static int core_expr_lookup(ap_expr_look
 static int expr_lookup_not_found(ap_expr_lookup_parms *parms)
 {
     const char *type;
+    const char *prefix = "";
 
     switch (parms->type) {
     case AP_EXPR_FUNC_VAR:
@@ -1689,8 +1695,12 @@ static int expr_lookup_not_found(ap_expr
         *parms->err = "Inavalid expression type in expr_lookup";
         return !OK;
     }
-    *parms->err = apr_psprintf(parms->ptemp, "%s '%s' does not exist", type,
-                               parms->name);
+    if (   parms->type == AP_EXPR_FUNC_OP_UNARY
+        || parms->type == AP_EXPR_FUNC_OP_BINARY) {
+        prefix = "-";
+    }
+    *parms->err = apr_psprintf(parms->ptemp, "%s '%s%s' does not exist", type,
+                               prefix, parms->name);
     return !OK;
 }
 



Mime
View raw message