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

Casey Duncan casey@zope.com
Tue, 27 Aug 2002 10:40:30 -0400


So this is simply a GET request with the If-Modified-Since header set cor=
rect?

-Casey

On Tuesday 27 August 2002 09:56 am, 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 return=
ed
> by Zope as part of a 304 response.  We're running Zope 2.5.1 through Ap=
ache
> 1.3.26 and pcgi.
>=20
> When a request is made to the server with an appropriate Is-Modified-Si=
nce
> header the code in lib/python/OFS/Image.py sets the Content-Length to t=
he
> length of the image data but returns an empty string.   My reading of t=
he
> HTTP/1.1 spec suggests this is an error, see quote below:
>=20
> "If a Content-Length header field (section 14.13) is present, its decim=
al
> value in OCTETs represents both the entity-length and the transfer-leng=
th.
> The Content-Length header field MUST NOT be sent if these two lengths a=
re
> different".
>=20
> 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 ha=
ve I
> misunderstood something?  I'm slightly concerned because this bit of co=
de
> is commented as follows:
>=20
> # Set header values since apache caching will return Content-Length
> # of 0 in response if size is not set here
>=20
> I can confirm that this is true, but don't understand why this should b=
e
> deemed a problem - no data is being returned.
>=20
> For those interested, our problem is that we have a firewall (well know=
n
> 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 passe=
s
> 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!
>=20
> 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.
>=20
> Steve
>=20
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -=20
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>=20