httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Life is hard, and then you die" <ron...@innovation.ch>
Subject Re: Filtered I/O ... again. :-)
Date Sat, 03 Jun 2000 11:00:04 GMT

On Sat, Jun 03, 2000 at 03:51:19AM -0700, Greg Stein wrote:
> On Sat, 3 Jun 2000, Life is hard, and then you die wrote:
> > On Wed, May 31, 2000 at 02:50:10PM -0700, Greg Stein wrote:
> >...
> > > Oh. That is better than my first pass on this. In my proposal, I said a
> > > zero-length buffer. But I can easily see a mistake where zero-length is
> > > passed (ap_rwrite(buf, len, r) without testing "len"), thus making things
> > > believe they just hit EOF. Better is a NULL pointer for the buffer. Even
> > > if somebody passes len==0, I find it quite "impossible" for them to
> > > arrange a NULL buffer pointer. If they do... TFB for them. That is like
> > > expecting ap_rwrite(NULL, 0, r) to "work". Negative!
> > 
> > Overloading ap_rwrite() will work, but I feel adding ap_rclose() would be
> > cleaner/more natural.
> 
> Nobody would be calling ap_rwrite(NULL, ...) or ap_rclose().
> 
> In ap_finalize_request_protocol(), Apache will tell the filters to flush
> their state. It does this by passing a NULL buffer.
> 
> The conversation with myself (above) was whether a NULL buffer could be
> confused with "normal operation", or whether it was a good signal to
> flush. My answer is that nobody is going to be able to pass a NULL buffer,
> so it is fine.
> 
> Technically, we could have filters implement a close/flush function, but
> we've been attempting to minimize the number of entry points for them (for
> simplicity).

In my expererience the code in close() is usually quite different from
that in write(), hence it's natural to have to different functions. But
this is just a minor difference in style.


  Cheers,

  Ronald


Mime
View raw message