Re: PHP 4.0 Bug #8017: PHP ignores "If-Modified-Since" headers

From: Date: Wed, 29 Nov 2000 16:47:21 +0000
Subject: Re: PHP 4.0 Bug #8017: PHP ignores "If-Modified-Since" headers
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-39600@lists.php.net to get a copy of this message
> JR>> The way it would work is very simple -- PHP, from how I > JR>> understand it, has two phases, first where it collects the > JR>> headers, and then where it outputs the body. At the moment where > JR>> it starts to output the body, it should compare the > JR>> Last-Modified header outputted by the script (if any) against > JR>> If-Modified-Since. If (Last-Modified > If-Modified-Since), it > JR>> proceeds normally and sends back a 200 code. If (Last-Modified > JR>> <= If-Modified-Since), it would not output any body -- ignoring > JR>> all "echo"s in the script and further HTML in the document. The > JR>> script, however, continues to execute normally, completely > JR>> oblivious that no body is being sent out. > > Hmm. That is not exactly what was meant by If-Modified-Since, I guess. How so? What I described is exactly what the HTTP spec says should happen. > Also, I'm not sure it worth this - we'd have to check for two headers on > _each_ script. Sorry I'm not sure what you mean here... It would only have to watch for *one* header -- Last-Modified. The web browser sends If-Modified-Since as part of the HTTP request, so it will be available and ready before script parsing begins. > On the other hand, now I see what you mean - it probably could be > implemented, though it is not so easy. There's a lot of code in Apache > that deals with all kinds of "special cases", and I'm not sure which of > them should be handled in PHP. Well, I sincerely hope it is implemented. :) As I said before, this "lack of functionality" hurts PHP's own web site too. Whoever wrote http://www.php.net/include/shared-manual.inc went to great lengths to calculate a Last-Modified date, when in reality it is useless since PHP ignores If-Modified-Since. (I'm assuming that their goal in calculating a Last-Modified date was to get the manual pages to cache.) Thanks. Jordan Russell

« previous php.dev (#39600) next »