[Zope-dev] Zope and streaming

Dieter Maurer dieter at handshake.de
Sat Dec 20 05:48:35 EST 2003


Andre Schubert wrote at 2003-12-16 15:35 +0100:
>i have a little problem.
>I cant find a way howto stream data from a Zope behind Apache.
>My coworker was playing a little bit with mod_fastcgi, and found a way
>to stream data via the mod_fastcgi module in Apache.
>But if we tested this with a fast-cgi enabled Zope it does not work.
>It seems that the fast-cgi-server inside Zope sends the data in
>8kByte chunks ?!

Sounds like a buffered file.

Note, that Zope was not designed for immediate streaming -- even
when you use "HTTPResponse.write".
In general: the "Content-Length" is required for "HTTPResponse.write"
(at least for some browsers).
When ZServer sees a large "Content-Length", it serves the content
via a temporary file to make content delivery to the (potentially slow)
client independent from the Zope worker process and to reduce memory
load. This means: the output from the worker process is written
to a temporary file and later served from this file by ZServer
independent from Zope.

You may try to work around this by setting "Content-Length" to
"0". In this case, some browsers will require a "Connection: close"
header to be able to work correctly with the streamed content.


Note that intermediate HTTP clients (Apache, Proxies, ...)
may buffer the content in a way similar to ZServer.
Thus, in general: HTTP is not well suited for streaming...

-- 
Dieter



More information about the Zope-Dev mailing list