You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2013/03/17 13:49:28 UTC
svn commit: r1457437 - in /httpd/httpd/trunk: docs/manual/expr.xml
server/util_expr_eval.c
Author: minfrin
Date: Sun Mar 17 12:49:27 2013
New Revision: 1457437
URL: http://svn.apache.org/r1457437
Log:
Expression parser: Add the ability to base64 encode and base64 decode
strings within the parser.
Modified:
httpd/httpd/trunk/docs/manual/expr.xml
httpd/httpd/trunk/server/util_expr_eval.c
Modified: httpd/httpd/trunk/docs/manual/expr.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/expr.xml?rev=1457437&r1=1457436&r2=1457437&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/expr.xml (original)
+++ httpd/httpd/trunk/docs/manual/expr.xml Sun Mar 17 12:49:27 2013
@@ -472,6 +472,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/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1457437&r1=1457436&r2=1457437&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Sun Mar 17 12:49:27 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)
@@ -1598,6 +1610,8 @@ 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 ? */