--0-1285637095-1206720314=:3407
Content-Type: text/plain; charset=us-ascii

Thanks for the reply.

I know it is possible to do it inside the handler. However, for performance reasons, we want to prevent the handler from running on every request by configuring Apache.

Thanks again
Woinshet


----- Original Message ----
From: Torsten Foertsch
To: modperl@perl.apache.org
Cc: woinshet abdella
Sent: Friday, March 28, 2008 10:10:20 AM
Subject: Re: Invoking an OutputFilterHandler for a particular User-Agent

On Fri 28 Mar 2008, woinshet abdella wrote:
> PerlRequire /usr/local/libexec/perl/startup.pl
> PerlModule Apache::CustomFilterTitle
>
> PerlOutputFilterHandler Apache::CustomFilterTitle
>

> ...
> This is working as expected.
> My question is, I need to find a way to invoke the handler ONLY for a
> particular user-agent.


use something like the following lines at start of your filter:

unless( $f->ctx ) {
unless( $f->r->headers_in->{'User-Agent'} eq 'Wanted' ) {
$f->remove;
return Apache2::Const:ECLINED;
}
}

Torsten


__________________________________________________ __________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
--0-1285637095-1206720314=:3407
Content-Type: text/html; charset=us-ascii


Thanks for the reply.

I know it is possible to do it inside the handler. However, for performance reasons, we want to prevent the handler from running on every request  by configuring Apache.

 

Thanks again

Woinshet


----- Original Message ----
From: Torsten Foertsch <torsten.foertsch@gmx.net>
To: modperl@perl.apache.org
Cc: woinshet abdella <woinshetm@yahoo.com>
Sent: Friday, March 28, 2008 10:10:20 AM
Subject: Re: Invoking an OutputFilterHandler for a particular User-Agent

On Fri 28 Mar 2008, woinshet abdella wrote:
> PerlRequire /usr/local/libexec/perl/startup.pl
> PerlModule Apache::CustomFilterTitle
> <Files ~ "*\.html">
>        PerlOutputFilterHandler Apache::CustomFilterTitle
> </Files>
> ...
> This is working as expected.
> My question is, I need to find a way to invoke the handler ONLY for a
> particular user-agent.

use something like the following lines at start of your filter:

unless( $f->ctx ) {
  unless(
$f->r->headers_in->{'User-Agent'} eq 'Wanted' ) {
    $f->remove;
    return Apache2::Const:ECLINED;
  }
}

Torsten




Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. http://mobile.yahoo.com/;_ylt=Ahu06i...Dypao8Wcj9tAcJ "> Try it now.
--0-1285637095-1206720314=:3407--