You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2003/01/10 07:19:58 UTC

EOS bucket in RESOURCE filters

Is it possible that the RESOURCE filters don't get the EOS bucket? I'm 
working on filter examples which use context to maintain status/keep 
remainder data between filter invocations for the same request. For some 
reason I don't get the EOS bucket, so I don't know how to flush the data 
stored in the filter context. I do see EOS in CONNECTION filters. I've 
tried to look at the existing modules for an example, but I didn't find 
any RESOURCE filters that use the context. It seems that the existing 
RESOURCE filters can work just fine without the EOS bucket being sent 
through.

Thanks.

__________________________________________________________________
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


Re: EOS bucket in RESOURCE filters

Posted by Jeff Trawick <tr...@attglobal.net>.
Stas Bekman <st...@stason.org> writes:

> Justin Erenkrantz wrote:
> > --On Saturday, January 11, 2003 8:07 PM +1100 Stas Bekman
> > <st...@stason.org> wrote:
> >
> >> ap_finalize_request_protocol covers all the other cases, by
> >> checking r->sent_eos. My question is why not always add the eos in
> >> ap_finalize_request_protocol()?
> > ap_finalize_request_protocol() is a last resort to ensure that even
> > with a faulty handler an EOS is sent down the chain.  But, if an EOS
> > is already sent, it is illegal to send another.  -- justin
> 
> Thanks Justin,
> 
> Does that mean that mod_status, mod_info and other standard generator
> handlers should be changed to send eos to be proper?

I think it is inaccurate to say that it is a "faulty handler" which
doesn't send down an EOS bucket.  Some handler using the simplest API
(ap_rwrite() et al) doesn't know about EOS buckets and isn't expected
to do something explicit to send one.

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Re: EOS bucket in RESOURCE filters

Posted by Stas Bekman <st...@stason.org>.
Justin Erenkrantz wrote:
> --On Saturday, January 11, 2003 8:07 PM +1100 Stas Bekman 
> <st...@stason.org> wrote:
> 
>> ap_finalize_request_protocol covers all the other cases, by
>> checking r->sent_eos. My question is why not always add the eos in
>> ap_finalize_request_protocol()?
> 
> 
> ap_finalize_request_protocol() is a last resort to ensure that even with 
> a faulty handler an EOS is sent down the chain.  But, if an EOS is 
> already sent, it is illegal to send another.  -- justin

Thanks Justin,

Does that mean that mod_status, mod_info and other standard generator 
handlers should be changed to send eos to be proper?

Currently there is not much documentation available, so the only way to 
learn how things should be written properly is to look at the core 
modules, in hope that they provide a proper example.

__________________________________________________________________
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


Re: EOS bucket in RESOURCE filters

Posted by Justin Erenkrantz <je...@apache.org>.
--On Saturday, January 11, 2003 8:07 PM +1100 Stas Bekman 
<st...@stason.org> wrote:

> ap_finalize_request_protocol covers all the other cases, by
> checking r->sent_eos. My question is why not always add the eos in
> ap_finalize_request_protocol()?

ap_finalize_request_protocol() is a last resort to ensure that even 
with a faulty handler an EOS is sent down the chain.  But, if an EOS 
is already sent, it is illegal to send another.  -- justin

Re: EOS bucket in RESOURCE filters

Posted by Stas Bekman <st...@stason.org>.
Greg Ames wrote:
> Stas Bekman wrote:
> 
>> Is it possible that the RESOURCE filters don't get the EOS bucket? 
> 
> 
> anything is possible in software ;-) but that would be pretty broken 
> IMO.  I don't recall seeing cases recently where we don't send EOS down 
> the complete output filter chain.

I've looked at the existing generator modules and it seems that they 
send the eos bucket only if they send a pipe/file down the stream. the 
default handler behaves similarly. ap_finalize_request_protocol covers 
all the other cases, by checking r->sent_eos. My question is why not 
always add the eos in ap_finalize_request_protocol()?

>> I'm working on filter examples which use context to maintain 
>> status/keep remainder data between filter invocations for the same 
>> request. For some reason I don't get the EOS bucket, so I don't know 
>> how to flush the data stored in the filter context. I do see EOS in 
>> CONNECTION filters. I've tried to look at the existing modules for an 
>> example, but I didn't find any RESOURCE filters that use the context.
> 
> 
> mod_includes's filter has tons of variables in its ctx and uses them 
> frequently.  I sometimes wonder if this contributes to the number of 
> bugs we've seen in it.  It certainly should be a RESOURCE filter.
> 
> The OLD_WRITE filter also stashes stuff in its ctx IIRC, and should be a 
> RESOURCE filter.

I did look at mod_include, it just was hard to quickly find the eos/ctx 
flush logic. I think i'm getting the grip of it.

Thanks Greg.

__________________________________________________________________
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


Re: EOS bucket in RESOURCE filters

Posted by Greg Ames <gr...@apache.org>.
Stas Bekman wrote:
> Is it possible that the RESOURCE filters don't get the EOS bucket? 

anything is possible in software ;-) but that would be pretty broken IMO.  I 
don't recall seeing cases recently where we don't send EOS down the complete 
output filter chain.

> I'm 
> working on filter examples which use context to maintain status/keep 
> remainder data between filter invocations for the same request. For some 
> reason I don't get the EOS bucket, so I don't know how to flush the data 
> stored in the filter context. I do see EOS in CONNECTION filters. I've 
> tried to look at the existing modules for an example, but I didn't find 
> any RESOURCE filters that use the context.

mod_includes's filter has tons of variables in its ctx and uses them frequently. 
  I sometimes wonder if this contributes to the number of bugs we've seen in it. 
  It certainly should be a RESOURCE filter.

The OLD_WRITE filter also stashes stuff in its ctx IIRC, and should be a 
RESOURCE filter.

Greg