[mod_python] Streaming output

Nic James Ferrier nferrier at tapsellferrier.co.uk
Mon Apr 23 18:50:43 EDT 2007


"Greg Fawcett" <greg at vig.co.nz> writes:

> Is there any way to stream output to a request object, instead of using
> req.write()? My application has to serve PDF documents (sometimes several
> tens of megabytes long). Access to these has to be controlled, and they are
> encrypted, so I can't just expose them as normal files to apache. PHP has a
> useful function passthru(command) which will run command and stream the
> output directly back to the client - is there any equivalent in python?
>
> On a related note, how "direct" is req.write()? I'd hate it to be buffering
> the whole PDF up somewhere along the line, before sending it to the
> client.

mod_python has sendfile which is similar to passthru

It means you can protect your PDF documents in non-webserver space but
still use apache to serve them.

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   


More information about the Mod_python mailing list