Submitted by : at: 2005-03-24T14:02:08+00:00 (16 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

I've prepared the Cache headers for ZwikiPages? like this using the Caching Policy Manager: Expires: now Cache-Control: max-age=0; must-revalidate Last-Modified: current/modified

(( In detail it looks like: jens@schlepptop:~/tmp$ wget -S http://localhost:9673/jens/jens-wiki/ZWiki --22:44:09-- http://localhost:9673/jens/jens-wiki/ZWiki

=> `ZWiki.8'

Auflösen des Hostnamen »localhost«.... Verbindungsaufbau zu localhost[]:9673... verbunden. HTTP Anforderung gesendet, warte auf Antwort...

1 HTTP/1.0 200 OK 2 Server: Zope/(Zope 2.7.4-0, python 2.3.5, linux2) ZServer?/1.1 Plone/2.0.4 3 Date: Thu, 24 Mar 2005 21:44:10 GMT 4 Content-Length: 30060 5 Content-Language:

-> 6 Expires: Thu, 24 Mar 2005 21:44:10 GMT -> 7 Last-Modified: Wed, 09 Mar 2005 19:25:49 GMT

8 Connection: Keep-Alive 9 Cache-Control: max-age=0, must-revalidate

10 Content-Type: text/html;charset=utf-8 ))

I have a caching Apache in front of my Plone+Zwiki. The caching-proxy stores the file. But for each new request the caching-proxy must ask zwiki, whether the file has changed in between, like this:

$ telnet localhost 9673 | head -40 Trying Connected to localhost. Escape character is '^]'. GET /jens/jens-wiki/ZWiki HTTP/1.1 If-Modified-Since: Wed, 09 Mar 2005 19:25:49 GMT

HTTP/1.1 200 OK Server: Zope/(Zope 2.7.4-0, python 2.3.5, linux2) ZServer?/1.1 Plone/2.0.4 Date: Thu, 24 Mar 2005 21:46:11 GMT Content-Length: 30060 Content-Language: Expires: Thu, 24 Mar 2005 21:46:11 GMT Last-Modified: Wed, 09 Mar 2005 19:25:49 GMT Cache-Control: max-age=0, must-revalidate Content-Type: text/html;charset=utf-8

<all the data>

** N.B.: Not only a 304 (Not Modified) is sent but the whole data **

Here is how CMFCore/FSFile? does it:

# HTTP If-Modified-Since header handling. header=REQUEST.get_header('If-Modified-Since', None) if header is not None:

header=string.split(header, ';')[0]? # Some proxies seem to send invalid date strings for this # header. If the date string is not valid, we ignore it # rather than raise an error to be generally consistent # with common servers such as Apache (which can usually # understand the screwy date string as a lucky side effect # of the way they parse it). try: mod_since=long(DateTime?(header).timeTime()) except: mod_since=None if mod_since is not None:

last_mod = self._file_mod_time if last_mod > 0 and last_mod <= mod_since:

# Set header values since apache caching will return # Content-Length of 0 in response if size is not set here RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod)) RESPONSE.setHeader('Content-Type', self.content_type) RESPONSE.setHeader('Content-Length', self.get_size()) RESPONSE.setStatus(304) return ''

I thought about adding this to wikipage function, but it does not seem to be applied. Usually this is done in the index_html function, but there is not such one for ZWiki, so I dont know where this code could be incorporated. Hints?

Grep for "setHeader(304)" to see how other content types handle this, if you want to fix this yourself (I'd be very glad).

regards, Jens

send in twice by "reload" button, Sorry --Thu, 24 Mar 2005 14:05:11 -0800 reply

Status: open => closed