mirror of
https://github.com/apache/httpd.git
synced 2025-08-15 23:27:39 +00:00
Fix some bugs in the use of APACHE_XLATE vs. CHARSET_EBCDIC
which prevented building with APACHE_XLATE on an ASCII machine. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -2365,9 +2365,6 @@ static int default_handler(request_rec *r)
|
||||
#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 @@ static int default_handler(request_rec *r)
|
||||
* 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 @@ static int default_handler(request_rec *r)
|
||||
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 @@ static int default_handler(request_rec *r)
|
||||
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);
|
||||
|
@ -58,16 +58,53 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
ap_status_t rv;
|
||||
|
@ -194,7 +194,7 @@ API_EXPORT(char *) ap_md5contextTo64(ap_pool_t *a, ap_md5_ctx_t *context)
|
||||
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 @@ API_EXPORT(char *) ap_md5digest(ap_pool_t *p, ap_file_t *infile,
|
||||
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;
|
||||
|
Reference in New Issue
Block a user