You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/04/15 14:36:23 UTC

svn commit: r1467969 - in /httpd/httpd/branches/2.4.x: ./ STATUS docs/manual/ docs/manual/expr.xml server/util_expr_eval.c

Author: jim
Date: Mon Apr 15 12:36:23 2013
New Revision: 1467969

URL: http://svn.apache.org/r1467969
Log:
Merge r1457437, r1457520 from trunk:

Expression parser: Add the ability to base64 encode and base64 decode
strings within the parser.


Remove the comment, this is done.

Submitted by: minfrin
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/docs/manual/   (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/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1457437,1457520

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1467969&r1=1467968&r2=1467969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Mon Apr 15 12:36:23 2013
@@ -90,13 +90,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * ap_expr: Expression parser: Add the ability to base64 encode and base64
-    decode strings within the parser.
-    trunk patch: http://svn.apache.org/r1457437
-                 http://svn.apache.org/r1457520
-    2.4.x patch: trunk patch applies.
-    +1: minfrin, druggeri, rjung
-
    * util_filter: Add in ap_remove_input|output_filter_byhandle()
     trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1458456
     2.4.x patch: trunk patch works modulo ap_mmn.h

Propchange: httpd/httpd/branches/2.4.x/docs/manual/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk/docs/manual:r1457437

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=1467969&r1=1467968&r2=1467969&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/expr.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/expr.xml Mon Apr 15 12:36:23 2013
@@ -459,6 +459,11 @@ listfunction ::= listfuncname "<strong>(
     <tr><td><code>unescape</code></td>
         <td>Unescape %hex encoded string, leaving encoded slashes alone;
             return empty string if %00 is found</td><td></td></tr>
+    <tr><td><code>base64</code></td>
+        <td>Encode the string using base64 encoding</td><td></td></tr>
+    <tr><td><code>unbase64</code></td>
+        <td>Decode base64 encoded string, return truncated string if 0x00 is
+            found</td><td></td></tr>
     <tr><td><code>file</code></td>
         <td>Read contents from a file</td><td>yes</td></tr>
     <tr><td><code>filesize</code></td>

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=1467969&r1=1467968&r2=1467969&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 Mon Apr 15 12:36:23 2013
@@ -1019,6 +1019,18 @@ static const char *escape_func(ap_expr_e
     return ap_escape_uri(ctx->p, arg);
 }
 
+static const char *base64_func(ap_expr_eval_ctx_t *ctx, const void *data,
+                               const char *arg)
+{
+    return ap_pbase64encode(ctx->p, (char *)arg);
+}
+
+static const char *unbase64_func(ap_expr_eval_ctx_t *ctx, const void *data,
+                               const char *arg)
+{
+    return ap_pbase64decode(ctx->p, arg);
+}
+
 #define MAX_FILE_SIZE 10*1024*1024
 static const char *file_func(ap_expr_eval_ctx_t *ctx, const void *data,
                              char *arg)
@@ -1575,9 +1587,10 @@ static const struct expr_provider_single
     { unescape_func,        "unescape",       NULL, 0 },
     { file_func,            "file",           NULL, 1 },
     { filesize_func,        "filesize",       NULL, 1 },
+    { base64_func,          "base64",         NULL, 0 },
+    { unbase64_func,        "unbase64",       NULL, 0 },
     { NULL, NULL, NULL}
 };
-/* XXX: base64 encode/decode ? */
 
 static const struct expr_provider_single unary_op_providers[] = {
     { op_nz,        "n", NULL,             0 },