#27345 [Bgs->Opn]: Status header with PHP CGI

From: Date: Mon, 23 Feb 2004 00:19:53 +0000
Subject: #27345 [Bgs->Opn]: Status header with PHP CGI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-55333@lists.php.net to get a copy of this message
ID: 27345 Updated by: et@php.net Reported By: php_bugs at ecora dot de -Status: Bogus +Status: Open Bug Type: CGI related PHP Version: Irrelevant New Comment: There's no reason for the CGI sapi cutting of the reason-phrase when creating the Status: line, is there? The Status: header that it's outputting is invalid. Previous Comments: ------------------------------------------------------------------------ [2004-02-22 17:35:38] edink@php.net See cgi.rfc2616_headers php.ini directive. ------------------------------------------------------------------------ [2004-02-22 15:41:39] et@php.net Nope, that's simply not true. It doesn't matter what you pass to header(). What matters is the output created by PHP, and if you use header("HTTP/1.0 404 Foo Bar"); PHP parses that and turns it into a Status: line if you use CGI. ------------------------------------------------------------------------ [2004-02-22 09:32:52] php_bugs at ecora dot de I don't know. Maybe there is also a PHP Bug, but IMHO there is at least a documentation bug. When you send a HTTP-Status-Header via the common gateway interface to the http-server, then you have to write: Status: ddd string instead of HTTP/1.1 ddd string Please take a look at the CGI-Specification : http://hoohoo.ncsa.uiuc.edu/cgi/out.html PARSED HEADERS The output of scripts begins with a small header. This header consists of text lines, in the same format as an HTTP header, terminated by a blank line (a line with only a linefeed or CR/LF). [..] Status This is used to give the server an HTTP/1.0 status line to send to the client. The format is nnn xxxxx, where nnn is the 3-digit status code, and xxxxx is the reason string, such as "Forbidden". ------------------------------------------------------------------------ [2004-02-22 06:11:02] et@php.net Well, to be correct, PHP just sends "Status: 404\r\n". ------------------------------------------------------------------------ [2004-02-22 06:09:08] et@php.net This is a bug, but not a documentation one. Both PHP4 and PHP5 just send "HTTP/1.1 404\r\n"... when doing header('HTTP/1.0 404 Not found'); which isn't conforming to RFC 2616 (There has to be at least one space after 404). That may cause Webservers to error out. This is definitively a bug. I don't think the "reason-phrase" should be discarded at all. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27345 -- Edit this bug report at http://bugs.php.net/?id=27345&edit=1

« previous php.bugs (#55333) next »