]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport from trunk:
authorJeff Trawick <trawick@apache.org>
Sat, 27 Aug 2005 15:02:05 +0000 (15:02 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 27 Aug 2005 15:02:05 +0000 (15:02 +0000)
  *) Support the suppress-error-charset setting, as with Apache 1.3.x.
     PR 31274.

Reviewed by: jorton, nd

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@240425 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/env.xml
include/http_core.h
modules/http/http_protocol.c
server/protocol.c

diff --git a/CHANGES b/CHANGES
index 45a9b9c3ff51e758219b4b2ea343a18e49237dc0..d1942deb7451eda44cb26a24660db81288784f33 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.0.55
 
+  *) Support the suppress-error-charset setting, as with Apache 1.3.x.
+     PR 31274.  [Jeff Trawick]
+
   *) EBCDIC: Handle chunked input from client or, with proxy, origin
      server.  [Jeff Trawick]
 
diff --git a/STATUS b/STATUS
index 7b6e55b1f5deabacd50aaddf05ca7edf31356c0b..2559ed2681b99de36068e03e23be6ac61a8aff4b 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -276,11 +276,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
         PR: 34452
         +1: jorton
 
-     *) Support the suppress-error-charset setting, as with Apache 1.3.x.
-        PR 31274. (current docs say it works with Apache from 2.0.40 ;) )
-        http://svn.apache.org/viewcvs?rev=170354&view=rev
-        +1: trawick, jorton, nd
-
      *) mod_mime_magic: Handle CRLF-format magic files so that it works with
         the default installation on Windows. 
         http://svn.apache.org/viewcvs?rev=179622&view=rev
index 1d4728f5b312c99cb5a19a85a2f8b5edb30e4a42..e7d0b425aaecb918cf3aef7b5ac9429563163c4b 100644 (file)
    <section id="suppress-error-charset">
        <title>suppress-error-charset</title>
 
-    <p><em>Available in versions after 2.0.40</em></p>
+    <p><em>Available in versions after 2.0.54</em></p>
 
     <p>When Apache issues a redirect in response to a client request,
     the response includes some actual text to be displayed in case
index 2b816659f89dbdf3107b03a0cd4e84547197d8c4..9028ff012bbb9778de022cc92e4fdf70b6c62cd4 100644 (file)
@@ -332,6 +332,9 @@ typedef struct {
     char **response_code_strings; /* from ap_custom_response(), not from
                                    * ErrorDocument
                                    */
+    /* Should addition of charset= be suppressed for this request?
+     */
+    int suppress_charset;
 } core_request_config;
 
 /* Standard entries that are guaranteed to be accessible via
index 09063528bb6986d4071c1c773d32d85df6c7756c..8b58453255968802c49802689cabef9777095b50 100644 (file)
@@ -2338,7 +2338,19 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
         r->content_languages = NULL;
         r->content_encoding = NULL;
         r->clength = 0;
-        ap_set_content_type(r, "text/html; charset=iso-8859-1");
+
+        if (apr_table_get(r->subprocess_env,
+                          "suppress-error-charset") != NULL) {
+            core_request_config *request_conf =
+                        ap_get_module_config(r->request_config, &core_module);
+            request_conf->suppress_charset = 1; /* avoid adding default
+                                                 * charset later
+                                                 */
+            ap_set_content_type(r, "text/html");
+        }
+        else {
+            ap_set_content_type(r, "text/html; charset=iso-8859-1");
+        }
 
         if ((status == HTTP_METHOD_NOT_ALLOWED)
             || (status == HTTP_NOT_IMPLEMENTED)) {
index a10610e01e7a5b99c679bf0f6a9406751d2ffed2..80cea4834c8282674c44e59a777d0e36c83de79f 100644 (file)
@@ -106,6 +106,7 @@ AP_DECLARE(const char *)ap_make_content_type(request_rec *r, const char *type)
     core_dir_config *conf =
         (core_dir_config *)ap_get_module_config(r->per_dir_config,
                                                 &core_module);
+    core_request_config *request_conf;
     apr_size_t type_len;
 
     if (!type) {
@@ -116,6 +117,12 @@ AP_DECLARE(const char *)ap_make_content_type(request_rec *r, const char *type)
         return type;
     }
 
+    request_conf =
+        ap_get_module_config(r->request_config, &core_module);
+    if (request_conf->suppress_charset) {
+        return type;
+    }
+
     type_len = strlen(type);
 
     if (apr_strmatch(charset_pattern, type, type_len) != NULL) {