You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2004/02/27 01:45:40 UTC

[mp2] $c->add_output_filter from within a filter doesn't work

I've tried to add an output connection filter from the input connection filter 
  when it was called for the first time. It didn't have any affect for the 
first request (over keepalive connection). The only way I succeeded to do that 
is from that input connection filter's filter_init handler. Has anyone else 
seen that strange behavior?

I think filter_init handler is the perfect place to add it, but I wonder why 
it didn't work when added from the input connection filter. Asking at 
httpd-dev is futile, so before I'm digging into the source, I hoped somebody 
has done that already.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] $c->add_output_filter from within a filter doesn't work

Posted by Stas Bekman <st...@stason.org>.
Geoffrey Young wrote:

>>I think filter_init handler is the perfect place to add it
> 
> 
> keep in mind that filter_init does not propagate the return value of the
> function properly - it may not apply to what you want to do, but just in
> case.  see some comments in modperl_run_filter_init for more details.

Yup, I read it. You mean the failure could be lost. So may be we should raise 
some flag and report the problem/cause abort some time later when it's doable?

I was thinking whether we can move filter_init run to a later stage (e.g. when 
the filter is invoked for the first time), but that would be wrong, as some 
things must happen before any filter is invoked.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] $c->add_output_filter from within a filter doesn't work

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Stas Bekman wrote:
> I've tried to add an output connection filter from the input connection
> filter  when it was called for the first time. It didn't have any affect
> for the first request (over keepalive connection). The only way I
> succeeded to do that is from that input connection filter's filter_init
> handler. Has anyone else seen that strange behavior?

never tried.

> 
> I think filter_init handler is the perfect place to add it

keep in mind that filter_init does not propagate the return value of the
function properly - it may not apply to what you want to do, but just in
case.  see some comments in modperl_run_filter_init for more details.

--Geoff


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [mp2] $c->add_output_filter from within a filter doesn't work

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> I've tried to add an output connection filter from the input connection 
> filter  when it was called for the first time. It didn't have any affect 
> for the first request (over keepalive connection). The only way I 
> succeeded to do that is from that input connection filter's filter_init 
> handler. Has anyone else seen that strange behavior?

In fact it does work if there is any filter additional filter of the same kind 
configured from httpd.conf or via filter_init. It looks like there is a bug in 
httpd, where it doesn't prepare the chain of 3rd party filter if none were 
inserted before the first filter was called.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org