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/18 21:54:45 UTC
cvs commit: apache-2.0/src/main http_core.c util_ebcdic.c util_md5.c
trawick 00/05/18 12:54:45
Modified: src/main http_core.c util_ebcdic.c util_md5.c
Log:
Fix some bugs in the use of APACHE_XLATE vs. CHARSET_EBCDIC
which prevented building with APACHE_XLATE on an ASCII machine.
Revision Changes Path
1.59 +6 -11 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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- http_core.c 2000/05/15 19:21:39 1.58
+++ http_core.c 2000/05/18 19:54:44 1.59
@@ -2365,9 +2365,6 @@
#ifdef USE_MMAP_FILES
ap_mmap_t *mm = NULL;
#endif
-#ifdef CHARSET_EBCDIC
- ap_xlate_t *xlate_to_net;
-#endif
/* This handler has no use for a request body (yet), but we still
* need to read and discard it if the client sent one.
@@ -2422,10 +2419,8 @@
* for serving raw ascii (text/x-ascii-{plain,html,...}), the type is
* corrected to the real text/{plain,html,...} type which goes into
* the headers.
- *
- * Note: convert_flag is not used in the MMAP path;
*/
- xlate_to_net = ap_checkconv(r);
+ r->rrx->to_net = ap_checkconv(r);
#endif
#ifdef USE_MMAP_FILES
if ((r->finfo.size >= MMAP_THRESHOLD)
@@ -2447,11 +2442,11 @@
if (mm == NULL) {
#endif
-#ifdef CHARSET_EBCDIC
+#ifdef APACHE_XLATE
if (d->content_md5 & 1) {
ap_table_setn(r->headers_out, "Content-MD5",
ap_md5digest(r->pool, fd,
- xlate_to_net));
+ r->rrx->to_net));
}
#else
if (d->content_md5 & 1) {
@@ -2494,9 +2489,9 @@
ap_md5_ctx_t context;
ap_MD5Init(&context);
-#ifdef CHARSET_EBCDIC
- if (xlate_to_net) {
- ap_MD5SetXlate(&context, xlate_to_net);
+#ifdef APACHE_XLATE
+ if (r->rrx->to_net) {
+ ap_MD5SetXlate(&context, r->rrx->to_net);
}
#endif
ap_MD5Update(&context, addr, (unsigned int)r->finfo.size);
1.6 +38 -1 apache-2.0/src/main/util_ebcdic.c
Index: util_ebcdic.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/util_ebcdic.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- util_ebcdic.c 2000/05/16 19:48:08 1.5
+++ util_ebcdic.c 2000/05/18 19:54:44 1.6
@@ -58,15 +58,52 @@
#include "ap_config.h"
-#ifdef CHARSET_EBCDIC
+#ifdef APACHE_XLATE
#include "httpd.h"
#include "http_log.h"
#include "http_core.h"
#include "util_ebcdic.h"
+/* Note: these variables really belong in util_charset.c, but it seems silly
+ * to create util_charset.c at the moment since it would only contain the
+ * variables.
+ */
+
+/* ap_hdrs_to_ascii, ap_hdrs_from_ascii
+ *
+ * These are the translation handles used to translate between the network
+ * format of protocol headers and the local machine format.
+ *
+ * For an EBCDIC machine, these are valid handles which are set up at
+ * initialization to translate between ISO-8859-1 and the code page of
+ * the source code.
+ *
+ * For an ASCII machine, these remain NULL so that when they are stored
+ * in the BUFF via ap_bsetop(BO_WXLATE or BO_RXLATE) it ensures that no
+ * translation is performed.
+ */
+
ap_xlate_t *ap_hdrs_to_ascii, *ap_hdrs_from_ascii;
+
+/* ap_locale_to_ascii, ap_locale_from_ascii
+ *
+ * These handles are used for the translation of content, unless a
+ * configuration module overrides them.
+ *
+ * For an EBCDIC machine, these are valid handles which are set up at
+ * initialization to translate between ISO-8859-1 and the code page of
+ * the httpd process's locale.
+ *
+ * For an ASCII machine, these remain NULL so that no translation is
+ * performed (unless a configuration module does something, of course).
+ */
+
ap_xlate_t *ap_locale_to_ascii, *ap_locale_from_ascii;
+
+#endif /*APACHE_XLATE*/
+
+#ifdef CHARSET_EBCDIC
ap_status_t ap_init_ebcdic(ap_pool_t *pool)
{
1.14 +1 -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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- util_md5.c 2000/05/11 02:32:05 1.13
+++ util_md5.c 2000/05/18 19:54:44 1.14
@@ -194,7 +194,7 @@
return encodedDigest;
}
-#ifdef CHARSET_EBCDIC
+#ifdef APACHE_XLATE
API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile,
ap_xlate_t *xlate)
@@ -203,14 +203,11 @@
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;