httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject what's the condition to stop reading input in connection handlers?
Date Wed, 30 Jun 2004 01:14:34 GMT
The doc for ap_get_brigade goes:

/**
  * Get the current bucket brigade from the next filter on the filter
  * stack.  The filter returns an apr_status_t value.  If the bottom-most
  * filter doesn't read from the network, then ::AP_NOBODY_READ is returned.
  * The bucket brigade will be empty when there is nothing left to get.

However I see a situation where, the client went away long time ago and the 
connection handler continues getting APR::EOF and the returned brigade is not 
empty (some empty IMMORTAL bucket) when calling ap_get_brigade and a custom 
output filter is installed.

What's the right condition to abort the loop? e.g in the pseudo code:

     while (1) {
         my $rc = $c->input_filters->get_brigade($bb, Apache::MODE_GETLINE);

         last if $bb->is_empty;
         # process $bb...
         last if $rc == APR::EOF;
    }

should I just check for EOF and not check whether the brigade is empty? If so, 
can EOF come and the brigade not being empty? It looks like I need to check both.

-- 
__________________________________________________________________
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

Mime
View raw message