diff options
author | Joe Orton <jorton@apache.org> | 2003-07-17 18:17:04 +0200 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2003-07-17 18:17:04 +0200 |
commit | 6ba19e3b5bdc0fb68fe2407d4d9ab80105df5d7e (patch) | |
tree | 4e45e2655d79b831de94b799f5a2c3cae8a262f8 /server/util_md5.c | |
parent | Oops. Replace * with *:80 in the <VirtualHost> example also. (diff) | |
download | apache2-6ba19e3b5bdc0fb68fe2407d4d9ab80105df5d7e.tar.xz apache2-6ba19e3b5bdc0fb68fe2407d4d9ab80105df5d7e.zip |
Speed up ap_md5digest() a little.
* util_md5.c (ap_md5digest): Use a larger buffer; ensure size is a
multiple of 64 to prevent buffering in MD5 code. Remove redundant
'length' variable. Reset read size in case of short reads.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100672 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/util_md5.c')
-rw-r--r-- | server/util_md5.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/server/util_md5.c b/server/util_md5.c index 5d8068b23b..6ec4571e1c 100644 --- a/server/util_md5.c +++ b/server/util_md5.c @@ -198,16 +198,15 @@ AP_DECLARE(char *) ap_md5contextTo64(apr_pool_t *a, apr_md5_ctx_t *context) AP_DECLARE(char *) ap_md5digest(apr_pool_t *p, apr_file_t *infile) { apr_md5_ctx_t context; - unsigned char buf[1000]; - long length = 0; + unsigned char buf[4096]; /* keep this a multiple of 64 */ apr_size_t nbytes; apr_off_t offset = 0L; apr_md5_init(&context); nbytes = sizeof(buf); while (apr_file_read(infile, buf, &nbytes) == APR_SUCCESS) { - length += nbytes; apr_md5_update(&context, buf, nbytes); + nbytes = sizeof(buf); } apr_file_seek(infile, APR_SET, &offset); return ap_md5contextTo64(p, &context); |