Re: [PHP-DEV] "If-Modified-Since" headers From: Jordan Russell (jr-phplist <email protected>)
Date: 11/29/00

Attached is a patch I wrote which adds the If-Modified-Since checking I've
been requesting. This is the first time I've ever cracked open the PHP
source code, so there may be some mistakes. But so far in my tests, it's
worked perfectly.

Notes:
1) I'm using the ap_parseHTTPdate function from Apache to convert textual
dates into time_t's. So it won't work with any other server at this time.
2) I compile PHP into Apache statically. I haven't tested this patch with
PHP as a DSO..

Here's what it looks like in action!

*** First request, with no If-Modified-Since:

GET /lastmod.php HTTP/1.0

HTTP/1.1 200 OK
Date: Wed, 29 Nov 2000 22:04:14 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

(body goes here)

*** Second request, with an If-Modified-Since of the same date:

GET /lastmod.php HTTP/1.0
If-Modified-Since: Mon, 27 Nov 2000 00:00:00 GMT

HTTP/1.1 304 Not Modified
Date: Wed, 29 Nov 2000 22:05:18 GMT
Server: Apache/1.3.14 (Unix) PHP/4.0.3pl1
X-Powered-By: PHP/4.0.3pl1
Connection: close
Content-Type: text/html

*** Third request, with an If-Modified-Since of the day before:

GET /lastmod.php HTTP/1.0
If-Modified-Since: Mon, 26 Nov 2000 00:00:00 GMT

HTTP/1.1 200 OK
Date: Wed, 29 Nov 2000 22:07:59 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

(body goes here)

Anyway, I hope this is helpful. (And merged into a future release ;)

Jordan Russell

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>