Re: new HTTP_Header package?
| From: | Wolfram Kriesing | Date: | Thu, 16 Jan 2003 11:30:20 +0000 |
| Subject: | Re: new HTTP_Header package? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12523@lists.php.net to get a copy of this message | ||
me again ... searching for votes :-)
Wolfram Kriesing wrote:
i needed to handle http-caching properly, so i started a package, which (one day) shall handle any http-header operations, such as caching, etc. there is one base-class HTTP_Header which implements common header methods and the first class, that i needed is the HTTP_Header_Cache, which wraps http-caching, see example below i could imagine other http-handlings to be implemented in HTTP_Header_* classes to make http-header handling a bit easier source is here http://os.visionp.de/tmp/HTTP_Header/Header.php.txt http://os.visionp.de/tmp/HTTP_Header/Cache.php.txt what do you think? example use of HTTP_Header_Cache-- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/auth$httpCache = new HTTP_Header_Cache();// we have a css-file here $httpCache->setHeader( 'Content-Type' , 'text/css' );// if the file is cached in the user-agent // and the template was not compiled again, we exit here $httpCache->exitIfCached( !$tpl->compiled() );// otherwise we send all the headers $httpCache->sendHeaders();... and keep on working the scriptimplemented by hand, without class:header('Pragma: cache'); header('Cache-Control: public');if( !$tpl->compiled() && $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) { header('HTTP/1.1 304 Not Modified'); exit; }header('Content-Type: text/css'); // the header has to loo like this: // Last-Modified: Mon, 27 Nov 2000 00:00:00 GMT header('Last-Modified: '.date('D, d M Y H:i:s T') );