[Zope] Browser Sticky Fingers

Bill Anderson bill.anderson@libc.org
Tue, 19 Oct 1999 22:11:08 -0600


Tony McDonald wrote:
> 
> At 5:45 pm +0200 19/10/99, Peter Sabaini wrote:
> >possibly the src= of the <img> points to a cgi program that returns "Expires:
> >(something soon)" headers so it wont get cached.
> >
> >in perl pseudocode (sorry i'm not that accustomed to python yet) you'd write
> >something like this:
> >
> ># this from thimble smith, tim@desert.net
> ># read image data
> >$img = <wherever you get the image data from, gif assumed>
> ># print expires with date=now
> >print "Expires: ", scalar(localtime), "\r\n";
> ># or whatever content, then insert gif data
> >print "Content-type: image/gif\r\n\n$img"
> 
> Neat!
> It looks like the place to change this is in the index_html method of
> OFS/Image.py
> 
> You *could* add an Expires header to the group of
> 
>          RESPONSE.setHeader('Last-Modified', rfc1123_date(self._p_mtime))
>          RESPONSE.setHeader('Content-Type', self.content_type)
> 
> lines near the end of this method, but I think that will mean that
> *all* images from a Zope system will be expired. A better solution
> would be if you could send an Expires header to the Image object.


What if the image object had an expires property that, when set, would
include those headers, and when unset would be 'normal' non-expiring
images? By default, the property would be unset, of course. This seems,
IMHO, to be a zopish way of doing it.

-- 
"They laughed at Columbus, they laughed at Fulton, they laughed at the
Wright brothers.  But they also laughed at Bozo the Clown." -- Carl
Sagan