php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34537 Last-Modified header + Status: 200 results in 200 OK without body
Submitted: 2005-09-17 13:40 UTC Modified: 2007-01-18 01:00 UTC
From: alisencer at gmail dot com Assigned:
Status: No Feedback Package: HTTP related
PHP Version: 5CVS-2005-09-22 OS: *
Private report: No CVE-ID: None
 [2005-09-17 13:40 UTC] alisencer at gmail dot com
Description:
------------
This is with Apache2 (PHP as CGI). When setting a Last-Modified header, apache/php automatically sets a 304 header and sends no body.

However if I additionally manually override the Status header with
header("Status: 200 OK");

The webserver responds with a 200 OK, however without any body. It also keeps the HTTP-Connection open until the timeout.

Reproduce code:
---------------
<?php
header("Status: 200 OK");
header("Last-Modified: Fri, 26 Aug 2005 11:53:55 GMT");
echo "test";
?>

curl -D - -H 'If-Modified-Since: Sat, 17 Sep 2005 09:18:01 GMT' http://url

Expected result:
----------------
==
HTTP/1.1 200 OK
Date: Sat, 17 Sep 2005 11:25:37 GMT
Last-Modified: Fri, 26 Aug 2005 11:53:55 GMT

test
==

Or alternatively:

==
HTTP/1.1 304 Not Modified
Date: Sat, 17 Sep 2005 11:26:16 GMT
==

Actual result:
--------------
HTTP/1.1 200 OK
Date: Sat, 17 Sep 2005 11:25:45 GMT
Server: Apache



(and then it hangs for a while, but no body is sent [checked with Ethereal]).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-18 22:25 UTC] sniper@php.net
Expected behaviour. Please read more about the headers at:
 
  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html


 [2005-09-19 01:58 UTC] alisencer at gmail dot com
Hi Sniper,

thanks for your quick reply. I think there's a misunderstatement. I know HTTP headers and how they work.

Please re-read the bug-report.

I am setting 200 OK and sending a body.

Something along the way decides it should be a 304, but does NOT change the status-code. Instead it silently drops the body of the response.

I don't know what this something along the way is - it might be PHP or it might be Apache2. But I doubt that this would be expected behaviour.


Thanks for your reconsideration and effort.
 [2005-09-19 02:40 UTC] rasmus@php.net
Does the same thing happen under Apache1?
 [2005-09-19 02:50 UTC] alisencer at gmail dot com
I was only able to test with Apache1.3 and mod_php (instead of CGI). There it does not happen, I get a regular 200 with body.
 [2005-09-19 08:58 UTC] sniper@php.net
Using Apache2 and apache2handler module I get the same results as with Apache1.

 [2006-02-21 13:48 UTC] mike@php.net
Most probably related to this Apache bug/behaviour:
http://issues.apache.org/bugzilla/show_bug.cgi?id=38070

 [2007-01-10 22:48 UTC] iliaa@php.net
Can you try to see if the problem is gone with 5.2-CVS and 
latest stable Apache2 server?
 [2007-01-18 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC