From: Jeff Trawick Date: Sat, 27 Aug 2005 15:02:05 +0000 (+0000) Subject: Backport from trunk: X-Git-Tag: 2.0.55~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=404520888a15c958aa2ca472346023bc487ef773;p=thirdparty%2Fapache%2Fhttpd.git Backport from trunk: *) 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 --- diff --git a/CHANGES b/CHANGES index 45a9b9c3ff5..d1942deb745 100644 --- 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 7b6e55b1f5d..2559ed2681b 100644 --- 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 diff --git a/docs/manual/env.xml b/docs/manual/env.xml index 1d4728f5b31..e7d0b425aae 100644 --- a/docs/manual/env.xml +++ b/docs/manual/env.xml @@ -339,7 +339,7 @@
suppress-error-charset -

Available in versions after 2.0.40

+

Available in versions after 2.0.54

When Apache issues a redirect in response to a client request, the response includes some actual text to be displayed in case diff --git a/include/http_core.h b/include/http_core.h index 2b816659f89..9028ff012bb 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -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 diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 09063528bb6..8b584532559 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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)) { diff --git a/server/protocol.c b/server/protocol.c index a10610e01e7..80cea4834c8 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -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) {