filter "chunks"
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Mod-Python > filter "chunks"




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    filter "chunks"  
Rob Miller


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-20-06 06:22 AM

i hope this is the right forum for mod_python newbie questions; it's the onl
y
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 i
n
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 th
e
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 a
t 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 ma
de
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 throug
h
apache filtering docs and some google searches, but haven't found anything
pertinent.  can anyone point me in the right direction?

thanks,

-r







[ Post a follow-up to this message ]



    Re: filter "chunks"  
Graham Dumpleton


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-20-06 06: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 entir
e
> 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 bein
g
> 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






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register