httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject cvs commit: httpd-2.0/server util_md5.c
Date Thu, 17 Jul 2003 16:17:05 GMT
jorton      2003/07/17 09:17:05

  Modified:    server   util_md5.c
  Log:
  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.
  
  Revision  Changes    Path
  1.30      +2 -3      httpd-2.0/server/util_md5.c
  
  Index: util_md5.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_md5.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -u -r1.29 -r1.30
  --- util_md5.c	3 Feb 2003 17:53:20 -0000	1.29
  +++ util_md5.c	17 Jul 2003 16:17:04 -0000	1.30
  @@ -198,16 +198,15 @@
   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);
  
  
  

Mime
View raw message