perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J Amuse" <jam...@gmail.com>
Subject output filters
Date Thu, 31 Jan 2008 14:17:29 GMT
I'm trying to write a filter using modperl that will update parts of the
server response on the fly. My first attempt was to rewrite the path setting
in the server's set cookie response to set the path to: path=/NewPath. After
copying and pasting some examples I came up with the following:
package Apache2::RewriteCookiePath;
use strict;
use warnings;
use Apache2::Filter ();
use Apache2::RequestRec ();
use APR::Table ();
use Apache2::Const -compile => qw(OK);
use constant BUFF_LEN => 1024;

sub handler {
my $f = shift;

while ($f->read(my $buffer, BUFF_LEN)) {
   $buffer =~ s/path=\//path=\/NewPath/g;
   $f->print($buffer);
}

return Apache2::Const::OK;
}
1;

I have not been able to get this code to work. How can I call this code from
a virtual host's config file so that it applies to all cookies set, no
matter what subdirectory is requested? This is my first attempt with
mod-perl, so any pointers would be really helpful.

Thanks

Mime
View raw message