php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27026 header('HTTP/1.0 200 OK') never sent when explicitly requested
Submitted: 2004-01-23 15:42 UTC Modified: 2004-02-09 19:09 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: achowe at snert dot com Assigned: edink (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 4CVS, 5CVS OS: *
Private report: No CVE-ID: None
 [2004-01-23 15:42 UTC] achowe at snert dot com
Description:
------------
While testing a 3rd party HTTP server (under Cygwin) that expects nph CGI behaviour, I have the following script:

#!/usr/local/bin/php-cgi
<?
	header("HTTP/1.0 200 OK");
	phpinfo();
?>

When called, the "HTTP/1.0 200 OK" line is never sent. If I rewrite the script to change the status code:

#!/usr/local/bin/php-cgi
<?
	header("HTTP/1.0 300 OK");
	phpinfo();
?>

Only then does the "HTTP/1.0 300 OK" appear as expected.  This result can be verified by a telnet connection to the server or on the command line.







Expected result:
----------------
If I explicitly set: 	

    header("HTTP/1.0 200 OK");

then I expect to see it in the output as the first line.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-25 00:22 UTC] sniper@php.net
From cgi_main.c CVS log:

revision 1.190.2.4
date: 2002/11/22 13:50:40;  author: edink;  state: Exp;  lines: +10 -7
Don't send default http status (200) (Thanks to Sascha Schumann for idea).

Edin, can you handle this report please. :)

 [2004-01-29 00:26 UTC] sniper@php.net
Maybe we should have some php.ini option to enable nph mode?
e.g. "cgi.non_parsed_headers" which defaults to 0 ?


 [2004-01-29 02:08 UTC] achowe at snert dot com
Creating yet another option seems a bit much when you know that an nph chi will have to set the header in the code. Why can't you just say if the header is explicitly set, then print it regardless of its value.

For me I see it as inconsistant behaviour. If I do nothing, I get no header, if I  set the status header to 200, I still don't get a status header even though I put code in to explicitly send it. If I specify anything anything other that 200, I get a status header. 

So my work around has been to send an undefined 2xx header to indicate undefined success, though not exactly what I would have liked. So far Mozilla, Opera, Internet Explorer, and Lynx appear to work, while Links does not (though I suspect for unrelated issue).

#!/usr/local/bin/php-cgi
<?
	header("HTTP/1.0 299 OK");
	phpinfo();
?>
 [2004-02-09 19:09 UTC] iliaa@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 17:01:29 2024 UTC