]> granicus.if.org Git - apache/commitdiff
Port a 1.3 EBCDIC fix to 2.0:
authorJeff Trawick <trawick@apache.org>
Tue, 25 Apr 2000 23:19:15 +0000 (23:19 +0000)
committerJeff Trawick <trawick@apache.org>
Tue, 25 Apr 2000 23:19:15 +0000 (23:19 +0000)
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

index f503cac09cbcda6688ac89c5e170124b4acd32ed..fb9f343131148106d137034f76e90a13e7e6f616 100644 (file)
@@ -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)