[Zope] Content-Length bug in Image.py?
Steve Lay
S.W.Lay@ucles-red.cam.ac.uk
Tue, 27 Aug 2002 14:56:42 +0100
We've been having some difficulty with image-performance on one of our
servers and have traced the problem to the Content-Length header returned
by Zope as part of a 304 response. We're running Zope 2.5.1 through Apache
1.3.26 and pcgi.
When a request is made to the server with an appropriate Is-Modified-Since
header the code in lib/python/OFS/Image.py sets the Content-Length to the
length of the image data but returns an empty string. My reading of the
HTTP/1.1 spec suggests this is an error, see quote below:
"If a Content-Length header field (section 14.13) is present, its decimal
value in OCTETs represents both the entity-length and the transfer-length.
The Content-Length header field MUST NOT be sent if these two lengths are
different".
So, we've patched our server by commenting out the line that sets the
Content-Length and our problem goes away. Is this a bug in 2.5.1 or have I
misunderstood something? I'm slightly concerned because this bit of code
is commented as follows:
# Set header values since apache caching will return Content-Length
# of 0 in response if size is not set here
I can confirm that this is true, but don't understand why this should be
deemed a problem - no data is being returned.
For those interested, our problem is that we have a firewall (well known
brand I think) that seems to cause the connections to hang for a about 10s
each time a 304 request for an image from one of our Zope servers passes
through it. As a result, graphic pages are fast the first time you hit
them (due to 200 responses) but deadly slow from then on!
Before I go patching my other servers, I thought I'd post here in case it
was a known problem and/or I've done something stupid.
Steve