Re: [SMARTY] Last-Modified header and fetch()
| From: | Ubaldo Huerta | Date: | Fri, 14 Feb 2003 19:32:18 +0000 |
| Subject: | Re: [SMARTY] Last-Modified header and fetch() | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7770@lists.php.net to get a copy of this message | ||
Monte,
Definitively works!
I just retrofitted your CVS change into my 2.3.1 version. I'm not ready for
2.4.x yet. Here is what I did.
Smarty line 664-> } else {
$this->_cache_info = array();
$this->_cache_info['template'][] = $_smarty_tpl_file;
// Monte cache fix
if ($this->cache_modified_check)
{
header("Last-Modified: ".gmdate('D, d M Y H:i:s', time()).'
GMT');
}
// End of Monte cache fix
}
Thanks. I saw the crash course (nice work). Anything to lower the barrier of
entry is a great thing!
ubaldo
LoQUo Barcelona Community
www.loquo.com/english
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Ubaldo Huerta" <ubaldo@loquo.com>
Cc: "Smarty General" <smarty-general@lists.php.net>
Sent: Friday, February 14, 2003 3:52 PM
Subject: Re: [SMARTY] Last-Modified header and fetch()
> Gooo catch. A patch is committed to CVS, see if that did the trick.
>
> On Fri, 2003-02-14 at 06:22, Ubaldo Huerta wrote:
> > I wonder why fetch() only sends 'Last-Modified' HTTP header once a
template
> > is compiled and cached, and not upon first compilation/caching of the
> > template. As far as I can see, there should be no problem sending
> > 'Last-Modified' = now() upon first compilation. I'll elaborate: (FYI:
you
> > need $cache_modified_check=true for any of this to work)
> >
> > I'm observing(*) that in order to reap the benefits of
'If-Modified-Since'
> > logic, the client needs to hit the same resource 3 times
> >
> > 1- Client request test.php.
> > Smarty compile/cache 'test.tpl' template ('Last-Modified' header
> > NOT
> > sent)
> >
> > 2- Client request test.php
> > If smarty cache still good, fetch() sends 'Last-Modified' with
timestamp
> > on step 1)
> >
> > 3- Client request test.php
> > If smarty cache still good, fetch() sends 304 Not Modified and no
> > content (bravo!) NOTE: for this magic to happen client needs to send
> > 'If-Modified-Since' with timestamp previously sent in 'Last-Modified'
header
> > (step 2)
> >
> > My question is why can't fetch send 'Last-Modified' in step 1? That way,
on
> > step 2, smart clients (proxy-caches all over the place, et al) could
get a
> > sweet 304 without content
> >
> > NOTE(*): I found this out using a cacheability test (
> > http://www.ircache.net/cgi-bin/cacheability.py)
> >
> > ubaldo
> >
> > LoQUo Barcelona Community
> > www.loquo.com
> --
> Monte Ohrt <monte@ispi.net>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>