#19098 [Opn]: header("Content-type: text/plain") does not work
| From: | michael dot mauch at gmx dot de | Date: | Tue, 27 Aug 2002 18:14:40 +0000 |
| Subject: | #19098 [Opn]: header("Content-type: text/plain") does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17955@lists.php.net to get a copy of this message | ||
ID: 19098
User updated by: michael.mauch@gmx.de
Reported By: michael.mauch@gmx.de
Status: Open
Bug Type: Apache related
Operating System: Linux
-PHP Version: 4CVS-2002-08-25
+PHP Version: 4CVS-2002-08-27
New Comment:
I just found out that the php-cgi adds an empty charset, if I don't set
it:
# echo '<? header("Content-type: text/xml");?>' | php-cgi
Status: 200
X-Powered-By: PHP/4.3.0-dev
Content-type text/xml;charset=
If I set the charset (even an empty one), mod_php _does_ send the
Content-type header.
<http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.1>:
| When no explicit charset parameter is provided by the
| sender, media subtypes of the "text" type are defined to
| have a default charset value of "ISO-8859-1" when
| received via HTTP.
So I think I should be allowed to set no charset.
Oh: if I disable the default_charset = "iso-8859-1" in php.ini, it
works just like it should, i.e. I can omit the charset and the
text/plain or text/xml header is sent.
Previous Comments:
------------------------------------------------------------------------
[2002-08-25 19:15:00] michael.mauch@gmx.de
With php4-STABLE-200208251500 and php4-200208251500 the header function
does not set the Content-type if it is text/xml or text/plain or
text/something.
It works with application/xml, and it works with php-4.2.2.
# HEAD http://localhost/~elmicha/php/header_xml.php
200 OK
Connection: close
Date: Sun, 25 Aug 2002 22:47:51 GMT
Server: Apache/1.3.26 (Unix) mod_perl/1.26 PHP/4.2.2
Content-Type: text/xml
Client-Date: Sun, 25 Aug 2002 22:47:51 GMT
Client-Response-Num: 1
X-Powered-By: PHP/4.2.2
# HEAD http://localhost/~elmicha/php/header_xml.php
200 OK
Connection: close
Date: Sun, 25 Aug 2002 22:48:43 GMT
Server: Apache/1.3.26 (Unix) mod_perl/1.26 PHP/4.2.3-dev
Content-Type: text/html; charset=iso-8859-1
Client-Date: Sun, 25 Aug 2002 22:48:43 GMT
Client-Response-Num: 1
X-Powered-By: PHP/4.2.3-dev
I configured both versions only --with-apxs. The test file:
<?php
header("Content-type: text/xml");
echo "<hello></hello>\n";
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19098&edit=1