Last-Modified header and fetch()
| From: | Ubaldo Huerta | Date: | Fri, 14 Feb 2003 12:22:25 +0000 |
| Subject: | Last-Modified header and fetch() | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-7759@lists.php.net to get a copy of this message | ||
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