httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
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     mod_perl Guide --->

View raw message