|
Home > Archive > Apache Mod-Python > July 2006 > filter "chunks"
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Rob Miller 2006-07-20, 1:22 am |
| i hope this is the right forum for mod_python newbie questions; it's the only
list i could find.
anyway, i'm using mod_python 3.1.4, with apache 2.0.55, both from ubuntu
packages. 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? is this a general apache
filter issue, or is it mod_python specific? 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?
thanks,
-r
| |
| Graham Dumpleton 2006-07-20, 1:22 am |
| 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/...ril/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
|
|
|
|
|