While working on this code I have discovered a bug in modperl-1.99_10, which is now fixed in cvs. Therefore to try this module you need the cvs version or 1.99_11 (which is not released at the moment). The module comes with a full test suite, so you can see it in action.
To write a new header manipulator all you need to do is to subclass this package and provide a simple function that manipulates the headers, e.g.:
# MyApache/FixupInputHTTPHeaders.pm package MyApache::FixupInputHTTPHeaders;
use base qw(Apache::Filter::HTTPHeadersManip);
sub manip { my ($class, $ra_headers) = @_;
# modify a header for (@$ra_headers) { s/^(Foo).*/$1: Moahaha/; }
# push header (don't forget "\n"!) push @$ra_headers, "Bar: MidBar\n"; } 1;
and then add to httpd.conf
<VirtualHost Zoot> PerlInputFilterHandler +MyApache::FixupInputHTTPHeaders </VirtualHost>
and voila, without using mod_perl HTTP callbacks you get to manipulate HTTP (input and output) headers for any other Apache module. Chris wanted this for his proxy module, which should work as well.
If you have comments regarding the naming or implementation/interface of this module please let me know before I release the first version on CPAN.
BTW, this module is smart enough not to filter request/response bodies. Though due to a bug in httpd, it can't be removed from the filters chain when its work is done, so it passively passes the data though itself. Hopefully one day that httpd bug will be fixed.
__________________________________________________________________ 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