httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: what's the condition to stop reading input in connection handlers?
Date Thu, 01 Jul 2004 02:04:19 GMT
Stas Bekman wrote:
> 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.

So I take it that it's OK to rely on the assumption that if APR_EOF is 
returned by ap_get_brigade(), then the returned brigade contains no (useful) 
data and the read loop can be broken.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

View raw message