#42848 [Opn->Asn]: Status: header incorrect under FastCGI
| From: | jani@php.net | Date: | Tue, 30 Oct 2007 22:15:36 +0000 |
| Subject: | #42848 [Opn->Asn]: Status: header incorrect under FastCGI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119108@lists.php.net to get a copy of this message | ||
ID: 42848
Updated by: jani@php.net
Reported By: madcamel at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: CGI related
Operating System: Linux, FreeBSD
PHP Version: 5.2.4
-Assigned To:
+Assigned To: dmitry
New Comment:
Dmitry, any ideas about this?
Previous Comments:
------------------------------------------------------------------------
[2007-10-23 16:25:33] madcamel at gmail dot com
Nope, still the same behavior.
I notice there is rudimentary handling for adding descriptions to
status codes in isapi/php5isapi.c:270
Could something like this but perhaps a little more robust be added to
the cgi/fcgi sapi perhaps?
------------------------------------------------------------------------
[2007-10-22 08:54:55] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2007-10-04 04:47:05] madcamel at gmail dot com
404 behavior:
$ php-fcgi does-not-exist.php
Status: 404
Content-type: text/html
Expected: "Status: 404 Not Found"
------------------------------------------------------------------------
[2007-10-04 04:41:30] madcamel at gmail dot com
Description:
------------
When PHP is used as a FastCGI it outputs incorrect Status: headers.
For example, a redirect triggered by header("Location: http://x.com/")
returns "Status: 302", not "Status: 302 Moved Temporarily" as is
explicitly required by the FastCGI specification.
This leads to most web servers returning "HTTP/1.1 302" instead of
"HTTP/1.1 302 Moved Temporarily", thereby breaking some very picky
browsers.
This problem also also occurs with 404 if a PHP file could not be
found, and I'm sure every other type of "Special" response. This makes
it different than bug 41738.
Related bugs:
http://bugs.php.net/bug.php?id=41378
http://bugs.php.net/bug.php?id=31065
http://bugs.php.net/bug.php?id=36705
Reproduce code:
---------------
--- Test 1
<?php
header("HTTP/1.1 302 Moved Permanently");
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Location: http://www.google.com/
Content-type: text/html
--- Test 2
<?php
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Location: http://www.google.com/
Content-type: text/html
--- Test 3
<?php
header("Status: 302 Moved Temporarily");
header("Location: http://www.google.com/");
?>
$ php-fcgi fun.php
Status: 302
Status: 302 Moved Temporarily
Location: http://www.google.com/
Content-type: text/html
Note the duplicate "Status:" headers, which is dissallowed by the
FastCGI spec.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42848&edit=1