[mod_python] Inspect request body before handing it over to mod_proxy

Jeremy Allen mod_python at jez.net.nz
Sun May 27 19:36:05 EDT 2007


Hi,

I'm using apache 2.2 with mod_proxy functioning as a reverse proxy.
I was hoping to use mod_python to inspect the body of the http request
before it gets handled by mod_proxy.

I can happily make a Python*Handler which will receive the request before
mod_proxy.
I can inspect and change headers before handing it off to mod_proxy but as
soon as I touch the body of the request things become trickier.
Request.read() will give me the body of the request but doing so consumes
the read characters from the body , thus passing on nothing down to
mod_proxy.

Am I right in thinking that I cannot merely observe the body of a request, I
have to consume it?
Also am I right in thinking that there is no way I can modify the body of a
request before it gets handed down the request processing chain? (so I could
read it then perhaps write it back to the request)

I have also tried using a filter instead of a handler but I'm not sure if it
is possible to trigger a server response like HTTP_FORBIDDEN from a filter.

Thanks,
Jeremy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070528/0aa6e174/attachment.html


More information about the Mod_python mailing list