You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Yoshiki Hayashi <yo...@xemacs.org> on 2003/12/03 20:43:21 UTC

[PATCH] Introduce suppress-error-charset to 2.1

This problem was brought up in Japanese user list some time
ago.  In spite of the document, httpd 2.0 and 2.1 do not
have special meaning for suppress-error-charset environment
variable.
http://httpd.apache.org/docs-2.1/env.html#special

This feature was introduced to httpd 1.3 in revision 1.326
of http_protocol.c with the following log message:

| 	Add a new environment variable to keep the charset from being
| 	included on canned error documents.  (Having it there make
| 	some browsers apply it to the redirect target document.)
| 
| Reviewed by:	Bill Stoddard, Jim Jagielski, Justin Erenkrantz, Cliff Woolley

http://cvs.apache.org/viewcvs.cgi/apache-1.3/src/main/http_protocol.c

When you test this patch, be sure to turn off
AddDefaultCharset.  It took me for a while to figure out who
is adding the charset again.

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.473
diff -u -r1.473 http_protocol.c
--- modules/http/http_protocol.c	16 Nov 2003 02:09:13 -0000	1.473
+++ modules/http/http_protocol.c	3 Dec 2003 19:16:44 -0000
@@ -2388,7 +2388,13 @@
         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) {
+          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)) {

-- 
Yoshiki Hayashi

Re: [PATCH] Introduce suppress-error-charset to 2.1

Posted by Yoshiki Hayashi <yo...@xemacs.org>.
Anyone?  I also attached a simple testcase for httpd-test.
You need to create perl-framework/t/htdocs/error_charset
directory.

BTW, where do I stand with regard to commit access to source
code area?  I think theoretically its RTC like others but
practically I feel much more comfortable if someone can
review my patch.

Yoshiki Hayashi <yo...@xemacs.org> writes:

> This problem was brought up in Japanese user list some time
> ago.  In spite of the document, httpd 2.0 and 2.1 do not
> have special meaning for suppress-error-charset environment
> variable.
> http://httpd.apache.org/docs-2.1/env.html#special
>
> This feature was introduced to httpd 1.3 in revision 1.326
> of http_protocol.c with the following log message:
>
> | 	Add a new environment variable to keep the charset from being
> | 	included on canned error documents.  (Having it there make
> | 	some browsers apply it to the redirect target document.)
> | 
> | Reviewed by:	Bill Stoddard, Jim Jagielski, Justin Erenkrantz, Cliff Woolley
>
> http://cvs.apache.org/viewcvs.cgi/apache-1.3/src/main/http_protocol.c
>
> When you test this patch, be sure to turn off
> AddDefaultCharset.  It took me for a while to figure out who
> is adding the charset again.
>

Index: modules/http/http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.473
diff -u -r1.473 http_protocol.c
--- modules/http/http_protocol.c	16 Nov 2003 02:09:13 -0000	1.473
+++ modules/http/http_protocol.c	3 Dec 2003 19:16:44 -0000
@@ -2388,7 +2388,13 @@
         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) {
+          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)) {