Re: [PHP-DEV] PHP 4.0 Bug #8017: PHP ignores "If-Modified-Since" headers From: Jason Greene (usrgre-php <email protected>)
Date: 11/30/00

PHP has a function that parses HTTP's date formats (RFC 822, RFC 850, asctime) as well as almost any date written in english
strtotime()

Once again, the php script would be somewhere around 5 lines, and you could include it in every php file.
Looking at your patch, instead of using ap_parseHTTPdate, use parsedate, see ext/standard/parsedate.c and basic_functions.c

Putting the code in SAPI.c is a good idea, but an INI parameter should probably be used to enable this functionality
This still will require making modifications to every SAPI module.

I'm still not convinced that php should handle this automaticly.

Zeev,
What do you think about this?

-Jason

----- Original Message -----
From: "Jordan Russell" <jr-phplist <email protected>>
To: "Frank M. Kromann" <fmk <email protected>>
Cc: <php-dev <email protected>>
Sent: Wednesday, November 29, 2000 1:36 PM
Subject: Re: [PHP-DEV] PHP 4.0 Bug #8017: PHP ignores "If-Modified-Since" headers

> > >When you have a client that visits a page 10 times a day, and the content
> > >never changes, the server is sending that web page 9 times more than
> > >necessary. If the script were to send a Last-Modified header, and PHP
> > >handled If-Modified-Since appropriately, the page would only be sent once
> to
> > >the client; subsequent requests would be pulled out of the web browser
> > >cache. Not only does this conserve bandwidth on the server end, it also
> > >makes the page come up significantly faster for the client. So it's a
> > >win-win situation for everyone.
> >
> > In other words, You require the developer to send an extra header in order
> for the engine to take care of caching. Why cant the developer send the
> extra header and make checks accordingly ? Most of the work will be done in
> the script anyway. You need to do this in the script to dertermine if the
> content of databases or other systems has changed. As a developer you will
> also be able to exit the script after sending the 304 header. You dont need
> any extra php functions to handle this.
>
>
> The reason why I think it should be built-in is because parsing
> If-Modified-Since is complicated -- the HTTP spec allows a number of
> different date formats. I think it's unreasonable to expect every PHP
> develeper to write his own If-Modified-Since parser (or obtain a third-party
> one) if they want to use Last-Modified-style caching. Not only that, it
> would run a whole lot faster in native C.
>
> I've produced a working patch for PHP 4.0.3pl1 which I'll post shortly...
>
> 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>
>

-- 
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>