quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Dumpleton" <grah...@dscpl.com.au>
Subject Re: filter "chunks"
Date Thu, 20 Jul 2006 02:34:57 GMT
Rob Miller wrote ..
> i hope this is the right forum for mod_python newbie questions; it's the
> only 
> list i could find.

The correct list is the one mentioned on the www.modpython.org web
site. Not sure how you missed it. This list is more for the developers of
mod_python.

> anyway, i'm using mod_python 3.1.4, with apache 2.0.55, both from ubuntu
> packages.

I would suggest you upgrade to at least 3.2.8 of mod_python. Better
still 3.2.10 when it is released some time in coming week.

> i'm trying to get apache to proxy (via RewriteRule) some content
> that is served from another server, and then to apply a mod_python-based
> filter (via SetOutputFilter) before serving up the content.  it's working,
> sort of; the content is coming out of the other server and is being passed
> in 
> to my output filter.  problem is, filter.read() is not returning the entire
> page, but instead only about the first third of it (7745 characters, to
> be 
> precise... ;-).
> 
> i turned on PythonEnablePdb, and realized that the filter is actually being
> invoked 3 times during the request, and each time the 'filter' object has
> the 
> next chunk of the page.  the content that's coming back is an XML document
> that i want to parse, so i need the whole thing before my filter will work
> at all.
> 
> i'm an experienced python developer but this is my first foray into apache
> innards.  is there a setting to tweak that will get the entire page to
> be made 
> available to the filter on its first invocation? 

No.

> is this a general apache
> filter issue, or is it mod_python specific? 

This is how Apache filters work.

> i've done some searching through
> apache filtering docs and some google searches, but haven't found anything
> pertinent.  can anyone point me in the right direction?

You need to accumulate the data until there is no more, join it back
together and then process it. See boilerplate example provided on
the other mailing list a while back at:

  http://www.modpython.org/pipermail/mod_python/2006-April/020869.html

Follow through the whole thread about the topic as there was a bit
of conversation back and forth about it which might also be interesting.

Graham

Mime
View raw message