You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/05/11 04:32:05 UTC
cvs commit: apache-2.0/src/main http_core.c util_md5.c
trawick 00/05/10 19:32:05
Modified: src/include util_md5.h
src/main http_core.c util_md5.c
Log:
EBCDIC: Update util_md5.c routines to use APR-ized ap_MD5*()
routines. As in 1.3, ap_md5digest() has a different function
signature when CHARSET_EBCDIC is defined :(
Revision Changes Path
1.11 +5 -0 apache-2.0/src/include/util_md5.h
Index: util_md5.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/include/util_md5.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- util_md5.h 2000/04/23 02:32:56 1.10
+++ util_md5.h 2000/05/11 02:32:04 1.11
@@ -68,7 +68,12 @@
API_EXPORT(char *) ap_md5(ap_pool_t *a, const unsigned char *string);
API_EXPORT(char *) ap_md5_binary(ap_pool_t *a, const unsigned char *buf, int len);
API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *p, ap_md5_ctx_t *context);
+#ifdef CHARSET_EBCDIC
+API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile,
+ ap_xlate_t *xlate);
+#else
API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile);
+#endif
#ifdef __cplusplus
}
1.56 +10 -2 apache-2.0/src/main/http_core.c
Index: http_core.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- http_core.c 2000/04/26 07:14:33 1.55
+++ http_core.c 2000/05/11 02:32:05 1.56
@@ -71,6 +71,7 @@
#include "util_md5.h"
#include "apr_fnmatch.h"
#include "http_connection.h"
+#include "util_ebcdic.h"
/* Allow Apache to use ap_mmap */
#ifdef USE_MMAP_FILES
@@ -2430,7 +2431,9 @@
#ifdef CHARSET_EBCDIC
if (d->content_md5 & 1) {
ap_table_setn(r->headers_out, "Content-MD5",
- ap_md5digest(r->pool, fd, convert_flag));
+ ap_md5digest(r->pool, fd,
+ convert_flag ?
+ ap_locale_to_ascii : NULL));
}
#else
if (d->content_md5 & 1) {
@@ -2467,12 +2470,17 @@
}
else {
char *addr;
- ap_mmap_offset((void**)&addr, mm ,0);
+ ap_mmap_offset((void**)&addr, mm ,0);
if (d->content_md5 & 1) {
ap_md5_ctx_t context;
ap_MD5Init(&context);
+#ifdef CHARSET_EBCDIC
+ if (convert_flag) {
+ ap_MD5SetXlate(&context, ap_locale_to_ascii);
+ }
+#endif
ap_MD5Update(&context, addr, (unsigned int)r->finfo.size);
ap_table_setn(r->headers_out, "Content-MD5",
ap_md5contextTo64(r->pool, &context));
1.13 +12 -4 apache-2.0/src/main/util_md5.c
Index: util_md5.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/util_md5.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- util_md5.c 2000/04/23 02:32:58 1.12
+++ util_md5.c 2000/05/11 02:32:05 1.13
@@ -89,6 +89,7 @@
#include "apr_portable.h"
#include "httpd.h"
#include "util_md5.h"
+#include "util_ebcdic.h"
API_EXPORT(char *) ap_md5_binary(ap_pool_t *p, const unsigned char *buf, int length)
{
@@ -103,6 +104,9 @@
*/
ap_MD5Init(&my_md5);
+#ifdef CHARSET_EBCDIC
+ ap_MD5SetXlate(&my_md5, ap_hdrs_to_ascii);
+#endif
ap_MD5Update(&my_md5, buf, (unsigned int)length);
ap_MD5Final(hash, &my_md5);
@@ -192,20 +196,24 @@
#ifdef CHARSET_EBCDIC
-API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile, int convert)
+API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile,
+ ap_xlate_t *xlate)
{
ap_md5_ctx_t context;
unsigned char buf[1000];
long length = 0;
int nbytes;
+ ap_size_t inbytes_left, outbytes_left;
ap_MD5Init(&context);
+#ifdef CHARSET_EBCDIC
+ if (xlate) {
+ ap_MD5SetXlate(&context, xlate);
+ }
+#endif
nbytes = sizeof(buf);
while (ap_read(infile, buf, &nbytes) == APR_SUCCESS) {
length += nbytes;
- if (!convert) {
- ascii2ebcdic(buf, buf, nbytes);
- }
ap_MD5Update(&context, buf, nbytes);
}
ap_seek(infile, 0L, APR_SET);