[Zope] Content-Length bug in Image.py?

Oliver Bleutgen myzope@gmx.net
Tue, 27 Aug 2002 17:15:00 +0200


Steve Lay wrote:
> 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:
> [...]
> 
> Steve

Steve,
maybe you don't need to patch all zopes. I know it's not a clean 
solution, but you should be able to use apache to rewrite the offending 
headers.
You should take a look at the header and rewrite directives, I'm quite 
sure that it's possible to fix up whatever zopes seems to be doing 
inappropriate for your firewall.


cheers,
oliver