httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1458004 - in /httpd/httpd/trunk: docs/manual/expr.xml server/util_expr_eval.c
Date Mon, 18 Mar 2013 21:16:18 GMT
Author: sf
Date: Mon Mar 18 21:16:18 2013
New Revision: 1458004

URL: http://svn.apache.org/r1458004
Log:
add md5 function, too

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=1458004&r1=1458003&r2=1458004&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/expr.xml (original)
+++ httpd/httpd/trunk/docs/manual/expr.xml Mon Mar 18 21:16:18 2013
@@ -481,6 +481,9 @@ listfunction ::= listfuncname "<strong>(
     <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>md5</code></td>
+        <td>Hash the string using MD5, then encode the hash with hexadecimal
+            encoding</td><td></td></tr>
     <tr><td><code>sha1</code></td>
         <td>Hash the string using SHA1, then encode the hash with hexadecimal
             encoding</td><td></td></tr>

Modified: httpd/httpd/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1458004&r1=1458003&r2=1458004&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Mon Mar 18 21:16:18 2013
@@ -25,6 +25,7 @@
 #include "http_request.h"
 #include "ap_provider.h"
 #include "util_expr_private.h"
+#include "util_md5.h"
 
 #include "apr_lib.h"
 #include "apr_fnmatch.h"
@@ -1051,6 +1052,13 @@ static const char *sha1_func(ap_expr_eva
     return out;
 }
 
+static const char *md5_func(ap_expr_eval_ctx_t *ctx, const void *data,
+                               const char *arg)
+{
+	return ap_md5(ctx->p, (const unsigned char *)arg);
+}
+
+
 #define MAX_FILE_SIZE 10*1024*1024
 static const char *file_func(ap_expr_eval_ctx_t *ctx, const void *data,
                              char *arg)
@@ -1633,6 +1641,7 @@ static const struct expr_provider_single
     { base64_func,          "base64",         NULL, 0 },
     { unbase64_func,        "unbase64",       NULL, 0 },
     { sha1_func,            "sha1",           NULL, 0 },
+    { md5_func,             "md5",            NULL, 0 },
     { NULL, NULL, NULL}
 };
 



Mime
View raw message