[ZCM] [ZC] 1345/ 3 Resolve "AcceleratedHTTPCacheManager doesn't set
Last-Modified"
Collector: Zope Bugs, Features,
and Patches ...
zope-coders-admin at zope.org
Sat May 22 05:20:28 EDT 2004
Issue #1345 Update (Resolve) "AcceleratedHTTPCacheManager doesn't set Last-Modified"
Status Resolved, Zope/bug+solution medium
To followup, visit:
http://zope.org/Collectors/Zope/1345
==============================================================
= Resolve - Entry #3 by ajung on May 22, 2004 5:20 am
Status: Pending => Resolved
Resolved on the 2.7 branch/SVN trunk
________________________________________
= Comment - Entry #2 by ajung on May 20, 2004 12:25 pm
Strange enough that the Last-Modified header has been commented inside
the file since revision 1.2. I have no problem with including this for 2.7.1.
________________________________________
= Request - Entry #1 by slinkp on May 20, 2004 12:02 pm
Apparently, AcceleratedHTTPCacheManager does not set a Last-Modified header.
See http://www.vasudevaservice.com/documentation/articles/plone_speed
which proposes this patch and says:
"""This will ensure that Zope returns a valid Last-Modified HTTP header. Without it, caches will assume that your content has been dynamically generated and is not suitable for caching.
"""
The patch is simple:
*** AcceleratedHTTPCacheManager.py.OLD Thu May 20 11:34:34 2004
--- AcceleratedHTTPCacheManager.py Thu May 20 11:37:37 2004
***************
*** 99,105 ****
# Set HTTP Expires and Cache-Control headers
seconds=self.interval
expires=rfc1123_date(time.time() + seconds)
! # RESPONSE.setHeader('Last-Modified',rfc1123_date(time.time()))
RESPONSE.setHeader('Cache-Control', 'max-age=%d' % seconds)
RESPONSE.setHeader('Expires', expires)
--- 99,105 ----
# Set HTTP Expires and Cache-Control headers
seconds=self.interval
expires=rfc1123_date(time.time() + seconds)
! RESPONSE.setHeader('Last-Modified',rfc1123_date(time.time()))
RESPONSE.setHeader('Cache-Control', 'max-age=%d' % seconds)
RESPONSE.setHeader('Expires', expires)
Note that I am not sure this is really the correct approach; we are ignoring the mtime_func which should probably be used instead of time.time().
Comments?
==============================================================
More information about the Zope-Collector-Monitor
mailing list