Roger Munk wrote:
On Sun, Feb 15, 2009 at 4:05 PM, Torsten Foertsch
<torsten.foert...@gmx.net> wrote:
If your page is generated by php and you only want to postprocess it on
its way out then drop the SetHandler. The PerlOutputFilterHandler does
not need a "SetHandler modperl".
Thanks, that was perfect. One more follow-up question. I want to
filter the cookies that the app sets when the user authenticates. The
app returns two 'Set-Cookie' headers, ie:
HTTP/1.1 200 OK
Date: Mon, 16 Feb 2009 14:25:27 GMT
Server: Apache
Set-Cookie: SESSf735b3e5ffd445f569dafde349c14e35=deleted; expires=Sun,
17-Feb-2008 14:25:26 GMT; path=/
Set-Cookie:
SESSf735b3e5ffd445f569dafde349c14e35=8281d2673e2a2d6625ec7a94ea3d9716;
expires=Wed, 11 Mar 2009 17:58:47 GMT; path=/; HttpOnly
My output filter handler gets the cookies via:
my $Cookie = $f->r->headers_out->get("Set-Cookie");
see http://perl.apache.org/docs/2.0/api/APR/Table.html#C_get_
(you only get the first one this way)
my @cookies = $f->r->headers_out->get("Set-Cookie");
would get you an array with both.
and then removes the expires=date bit with:
if ($Cookie)
{
$Cookie =~ s/expires.*GMT\;//g;
$f->r->headers_out->set("Set-Cookie" => "$Cookie");
}
The problem is that this code only seems to remove the expires date in
the first cookie. The second cookie never shows up in the filtered
HTTP response headers. How can I filter the second cookie as well?
Thanks
- Roger