#19207 [Opn->Fbk]: php-cgi.exe does not correctly set HTTP status
| From: | jmoore@php.net | Date: | Tue, 24 Sep 2002 16:48:12 +0000 |
| Subject: | #19207 [Opn->Fbk]: php-cgi.exe does not correctly set HTTP status | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-20210@lists.php.net to get a copy of this message | ||
ID: 19207
Updated by: jmoore@php.net
Reported By: Wendell@thePinegars.com
-Status: Open
+Status: Feedback
Bug Type: IIS related
Operating System: Windows 2000/.Net Server RC1
PHP Version: 4CVS-2002-08-30
New Comment:
what version of IIS are you using.. this works fine on Win XP Pro (No
service pack) so IIS 5.0.
- James
--
James Moore
jmoore@php.net
Previous Comments:
------------------------------------------------------------------------
[2002-09-05 11:22:02] Wendell@thePinegars.com
Just tried the latest snapshot php4-win32-200209051400.zip and the
issue still exists. php-cgi.exe returns the following headers:
Status: 401
Content-type: text/html
WWW-authenticate: basic realm=Logon
The correct headers for php-cgi.exe to work in IIS should be:
HTTP/1.1 401 Unauthorized
Content-type: text/html
WWW-authenticate: basic realm=Logon
------------------------------------------------------------------------
[2002-09-04 21:30:20] kalowsky@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
I believe there was just a patch submitted that fixes this. I could be
wrong though too, please test and update if still valid. :\
------------------------------------------------------------------------
[2002-08-30 20:09:13] Wendell@thePinegars.com
The following code fragment works great with PHP 4.2.2 on IIS:
Header("WWW-authenticate: basic realm=Logon");
Header("HTTP/1.1 401 Unauthorized");
echo "<HTML>\n";
echo " <HEAD>\n";
echo " <TITLE>Authorization Required</TITLE>\n";
echo " </HEAD>\n";
echo " <BODY BGCOLOR=#FFFFFF TEXT=#000000>\n";
echo " Invalid username and password with which to access this
webpage.<P><br><br>\n";
echo " </BODY>\n";
echo "</HTML>\n";
exit;
This code works correctly in 4.2.2. It sets the status of the page to
401 and makes the browser prompt for the password.
However using php-cgi.exe in the latest 4.3.0 development builds in IIS
the code does not work. The browser receive a "HTTP/1.1 200 OK"
instead of "HTTP/1.1 401 Unauthorized". If I simply run the CGI script
from the command prompt using php-cgi.exe in 4.3.0 I get the
following:
Status: 401
Content-type: text/html
WWW-authenticate: basic realm=Logon
<HTML>
<HEAD>
<TITLE>Authorization Required</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF TEXT=#000000>
Invalid username and password with which to access this
webpage.<P><br><br>
</BODY>
</HTML>
Running php.exe 4.2.2 from the console I get the following:
HTTP/1.1 401 Unauthorized
Content-type: text/html
WWW-authenticate: basic realm=Logon
<HTML>
<HEAD>
<TITLE>Authorization Required</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF TEXT=#000000>
Invalid username and password with which to access this
webpage.<P><br><br>
</BODY>
</HTML>
Noticed that php 4.2.2 correctly returns the HTTP page status as
"HTTP/1.1 401 Unauthorized" and php 4.3.0 only returns the tag "Status:
401".
The new tag "Status: 401" does not work in IIS, it needs to be the full
"HTTP/1.1 401 Unauthorized".
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19207&edit=1