From 429098f3b4659c19d6adb6e739c55b70efaab9e6 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 25 Apr 2000 23:19:15 +0000 Subject: [PATCH] Port a 1.3 EBCDIC fix to 2.0: This is a port of my 1.3 patch which allows error response strings to be translated from ebcdic to ascii. This bug is triggered by trying to access a non-existant .gif for example. The content type starts out being image/gif but is switched by error processing to text/html. Without this patch, ap_checkconv() is called too early (before the error processing), so the ebcdic conversion flag gets turned off and the eventual "404 Not Found" error response is sent to the browser still in ebcdic. Not very pretty. Submitted by: Greg Ames Reviewed by: Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85040 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http/http_core.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/http/http_core.c b/modules/http/http_core.c index f503cac09c..fb9f343131 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -2346,14 +2346,7 @@ static int default_handler(request_rec *r) ap_mmap_t *mm = NULL; #endif #ifdef CHARSET_EBCDIC - /* To make serving of "raw ASCII text" files easy (they serve faster - * since they don't have to be converted from EBCDIC), a new - * "magic" type prefix was invented: text/x-ascii-{plain,html,...} - * If we detect one of these content types here, we simply correct - * the type to the real text/{plain,html,...} type. Otherwise, we - * set a flag that translation is required later on. - */ - int convert_flag = ap_checkconv(r); + int convert_flag; #endif /* This handler has no use for a request body (yet), but we still @@ -2402,6 +2395,18 @@ static int default_handler(request_rec *r) return errstatus; } +#ifdef CHARSET_EBCDIC + /* ap_checkconv() sets a flag in the buff based on content type + * to indicate whether text charset conversion should be done + * later. If the content type contains the "magic" prefix + * 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; + */ + convert_flag = ap_checkconv(r); +#endif #ifdef USE_MMAP_FILES if ((r->finfo.size >= MMAP_THRESHOLD) && (r->finfo.size < MMAP_LIMIT) -- 2.50.1