Bug #8017 Updated: PHP ignores "If-Modified-Since" headers
| From: | hholzgra@php.net | Date: | Mon, 17 Jun 2002 17:20:48 +0000 |
| Subject: | Bug #8017 Updated: PHP ignores "If-Modified-Since" headers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-10885@lists.php.net to get a copy of this message | ||
ID: 8017
Updated by: hholzgra@php.net
Reported By: jr-php@quo.to
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux
PHP Version: 4.0.3pl1
New Comment:
it is in the responsibility of the application code
to check for If-Modified-Since conditions and to
send 304 Status codes,
as PHP itself can't know what the data you are
going to produce looks like or whether it has
changed since the last request in advance
without executing your code
PS: whatever the CGI script you are refering to
does, i'm rather sure that it deals with that
itself, too
Previous Comments:
------------------------------------------------------------------------
[2000-11-29 11:57:24] stas@php.net
moved to feature request
------------------------------------------------------------------------
[2000-11-29 11:52:34] jr-php@quo.to
Closed since it doesn't appear to be a bug, but rather missing
functionality in PHP.
------------------------------------------------------------------------
[2000-11-28 16:58:56] jr-php@quo.to
PHP: 4.0.3p1
Apache: 1.3.14
Browser: IE 5.5 SP1
Because I want my PHP pages to be cached, my PHP script sends out a
Last-Modified header (entire code follows):
<?php
Header ("Last-Modified: Mon, 27 Nov 2000 00:00:00 GMT");
?>
Test...
One would think that this would be enough to get a web browser to cache
the page, but evidently it is not. Examining my web server's access log
shows that each time the page is subsequently requested (e.g. by
pressing Refresh), it sends back a "200 OK" response code instead of a
"304 Not Modified" as it should. In other words, the server is sending
back a fresh copy of the page every time.
However, if I do a similar thing using a CGI script, the server *does*
send back "304" codes as it should (entire code follows):
#!/bin/sh
echo "Last-Modified: Mon, 27 Nov 2000 00:00:00 GMT"
echo "Content-Type: text/html"
echo ""
echo "Test..."
In both cases, an "If-Modified-Since" header is being sent to the
server. Yet the PHP script appears to ignore it completely and send a
fresh page, while the very simple CGI shell script doesn't.
P.S. At the bottom of this are transcripts of the HTTP requests for the
PHP & CGI scripts. Notice how PHP sends back a fresh page even though
the If-Modified-Since date is the same as the Last-Modified date.
P.P.S. I just noticed that this problem affects PHP's own web site too!
The page http://www.php.net/ returns a Last-Modified header, but
browsers receive a fresh copy of the page every time since
If-Modified-Since is ignored.
--- PHP script ---
GET /test.php HTTP/1.0
If-Modified-Since: Mon, 27 Nov 2000 00:00:00 GMT
HTTP/1.1 200 OK
Date: Mon, 27 Nov 2000 20:41:29 GMT
Server: Apache/1.3.14 (Unix) PHP/4.0.3pl1
X-Powered-By: PHP/4.0.3pl1
Last-Modified: Mon, 27 Nov 2000 00:00:00 GMT
Connection: close
Content-Type: text/html
Test...
--- CGI shell script ---
GET /cgi-bin/test.cgi HTTP/1.0
If-Modified-Since: Mon, 27 Nov 2000 00:00:00 GMT
HTTP/1.1 304 Not Modified
Date: Mon, 27 Nov 2000 20:41:46 GMT
Server: Apache/1.3.14 (Unix) PHP/4.0.3pl1
Connection: close
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=8017&edit=1