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/12/11 19:38:06 UTC

what response code filters should return when they see c->aborted?

If the connection is aborted filters need to know how to deal with that
situation and not waste resources processing data which is going to be dumped
anyway. It's easy to do by checking c->aborted every so often. The question
is, what's the proper response code should the filter return if it decides not
to process data any longer since it saw c->aborted is true? AP_NOBODY_WROTE?
AP_FILTER_ERROR?

What's confusing is that it seems that most consumers (not filters) (e.g. in
protocol.c) that call ap_pass_brigade are completely ignoring its response code.

I suppose cleanly aborting the request is at least important for the logging
purposes.

__________________________________________________________________
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: what response code filters should return when they see c->aborted?

Posted by Sami Tikka <sa...@f-secure.com>.
On Thu, Dec 11, 2003 at 10:38:06AM -0800, Stas Bekman wrote:
> What's confusing is that it seems that most consumers (not filters) (e.g. in
> protocol.c) that call ap_pass_brigade are completely ignoring its response 
> code.

It seems to me that many output filters are also ignoring
ap_pass_brigade return code. Also, the few sample filters I've seen do
that all the time.

Lately I have been searching for a memory leak in my output filter and
was wondering if it is safe to "return ap_pass_brigade(f->next, bb)" if
my filter is holding on to some buckets in a private brigade which is
hanging in f->ctx.

Should a filter always check ap_pass_brigade return code and when it
sees an error, cleanup its own mess before returning?

Or does it matter? If the brigade was created with
"apr_brigade_create(f->r->pool, f->c->bucket_alloc)", does it mean the
brigade is cleaned up when the request pool is destroyed? And all the
buckets in the brigade are returned to the allocator?

-- 
  Sami Tikka                          tel: +358 9 2520 5115
  Senior Software Engineer            fax: +358 9 2520 5013
  F-Secure Corporation                http://www.F-Secure.com/
  F-Secure: Securing the Mobile, Distributed Enterprise