You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by sterling <st...@covalent.net> on 2001/11/20 21:55:55 UTC

[PATCH] When apache generates html it should probably set the content type

Hi -

If you're default content type is something other than text/html and you
hit ap_send_error_response - apache sends html, but the content-type may
be something else.

this patch ensures that the content type is properly set if we return
html.  Anyone see any better way to handle this?

This can be reproduced by setting ErrorDocument 401, setting your default
content type to text/plain, and turning on auth in <Location />.  Simply
log in with an improper username and html will be rendered as plain text.

 sterling


Index: http_protocol.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/http_protocol.c,v
retrieving revision 1.379
diff -u -r1.379 http_protocol.c
--- http_protocol.c	2001/11/08 19:35:32	1.379
+++ http_protocol.c	2001/11/20 19:36:18
@@ -1914,7 +1914,7 @@
         /* can't count on a charset filter being in place here,
          * so do ebcdic->ascii translation explicitly (if needed)
          */
-
+        rlast->content_type = "text/html";
         ap_rvputs_proto_in_ascii(rlast,
                   DOCTYPE_HTML_2_0
                   "<html><head>\n<title>", title,