Re: [Zope] Re: Slow File Access With LocalFS
Jonothan Farr writes:
It sounds to me like the Apache server is just writing the data directly to the HTTP connection as it is read. I believe that's how HTTP "streaming" works. I also believe this is possible to do using the Zope HTTPResponse object. Does anyone have any ideas? We use it to deliver images from a multimedia database.
In Zope 2.1.0, it was not at all easy to use the HTTP streaming. Many proxies and IE require the Content-Length header to be correct. To set a correct "Content-Length" was not a problem. However, ZPublisher.HTTPResponse reset it afterwards to 0, leading to very strange effects in various situations (i.e. with IE and some Proxies). We finally settled it in the following way: RESPONSE.setHeader('Content-Length',length) RESPONSE.setHeader('transfer-encoding','binary') # to prevent RESPONSE.__str__ to overwrite "Content-Length" RESPONSE.headers['Content-Length']= length # now do several "RESPONSE.write" I am not sure, whether 2.1.6 or 2.2 still requires this strange code sequence. For Zope 2.1.6, we detected a nasty ZServer bug with the streaming protocol: missing thread synchronization. As a result, browsers got a non-deterministic part of the image. Very nice effects.... DC told me, that this bug is fixed in the CVS and for Zope 2.2. Thus, do not use the HTTP streaming protocol for the standard Zope 2.1.6 distribution (or be ready to patch ZServer). Dieter
participants (1)
-
Dieter Maurer