#19207 [NEW]: php-cgi.exe does not correctly set HTTP status
| From: | Wendell at thePinegars dot com | Date: | Sat, 31 Aug 2002 00:09:13 +0000 |
| Subject: | #19207 [NEW]: php-cgi.exe does not correctly set HTTP status | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-18299@lists.php.net to get a copy of this message | ||
From: Wendell@thePinegars.com
Operating system: Windows 2000/.Net Server RC1
PHP version: 4CVS-2002-08-30
PHP Bug Type: IIS related
Bug description: php-cgi.exe does not correctly set HTTP status
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 bug report at http://bugs.php.net/?id=19207&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19207&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19207&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19207&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19207&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19207&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19207&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19207&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19207&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19207&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19207&r=globals