|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-05-22 09:31 UTC] kaz at telemedia dot hu
source code at http://localhost/talalka.php : <?php header("Content-type: text/plain"); echo "LOFASZ\n"; ?> command running: /usr/bin/lynx -source -mime_header http://localhost/talalka.php result: HTTP/1.1 200 OK Date: Wed, 22 May 2002 13:24:29 GMT Server: Apache/1.3.22 (Unix) PHP/4.1.2 X-Powered-By: PHP/4.1.2 Connection: close Content-Type: text/plain LOFASZ As you can see, php sends wrong header. The "Content-type" header is not sent as i wrote it into the header function, and this causes chaos, because as the cgi specification, this header is case sensitive and has to be written as "Content-type". PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 17:00:02 2025 UTC |
#1 HTTP headers are defined as Case-Insensitive. period. #2 CGI does not specify headers at all #3 this is not a PHP issue, PHP passes the content-type to apache, it is the apache web server that treats the content-type header special and writes the Content-Type: part of the header line in this case this will happen to every Content-Type header set by an apache module, it will not happen for CGIs you can verify this by using the PHP command line interface (CLI): echo "<?php header('Content-type: text/plain'); ?>" | php result: X-Powered-By: PHP/4.2.0 Content-type: text/plaingood luck ;) again: apache does nothing wrong here, as HTTP headers are defined as case insensitive whatever "causes chaos" for you is something that is *not* HTTP complient, so you should try to get that fixed instead of blaming software that is perfectly compliant, although maybe in a way you didn't expect ... please read the HTTP specs RRF2616, 4.2 Message Headers: "... Field names are case-insensitive. ..." (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) RFC2616, 14.17 Content-Type Content-Type = "Content-Type" ":" media-type