Eric J. Hansen wrote:
I have an application that uses mod_proxy (as a reverse proxy) to fetch content
from a back-end server.  My application needs to do some manipulation of both
the request headers and the response body.  Given that mod_proxy circumvents
most of mod_perl's handler phases, I'm having to use filters to do what I need
to do.

To manipulate the request headers, I'm using Stas' HTTPHeadersFixup module (i.e.,
I set Accept-Encoding: none, etc.)  Then I'm using a HTTP output filter to
analyze & modify the actual content as its being sent back to the browser.

The question I have is how to pass data between the input connection filter
and the output http filter.  For example, I'd like to set a yes/no flag, or even
a hash reference, and then retrieve it from the output filter. Ordinarily, I would
happily use notes/pnotes to do this, but since connection filters don't have
access to the $r object, this doesn't fly.  Any ideas for doing this conveniently,
short of using an external memory/db cache?

Yes, but you have connection notes, which work exactly like request notes but you call them on the connection object.
http://perl.apache.org/docs/2.0/api/Apache/Connection.html#C_notes_
The only problem you have with that is the need to know when to reset those notes, since with KeepAlive you will have more than one request coming over the same connection. It's a bit tricky, but it's explained here:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Connection_Filters_over_KeepAlive_Connections


Apache::Filter::HTTPHeadersFixup uses this exact communication technique that you are talking about.

--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to