httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: [PATCH] update brigade buffering.
Date Fri, 09 Feb 2001 00:54:38 GMT

> >static int check_brigade_flush(const char **str,
> >                                apr_size_t *n, apr_bucket_brigade *bb)
> >{
> >     apr_bucket *b = APR_BRIGADE_LAST(bb);
> >
> >     if (APR_BRIGADE_EMPTY(bb)) {
> >         if (*n > APR_BUCKET_BUFF_SIZE) {
> >             apr_bucket *e = apr_bucket_transient_create(*str, *n);
> >             APR_BRIGADE_INSERT_TAIL(bb, e);
> >             return 1;
> 
> >APU_DECLARE(int) apr_brigade_write(apr_bucket_brigade *b, const char 
> >*str, apr_size_t nbyte)
> >{
> >     if (check_brigade_flush(&str, &nbyte, b)) {
> >         if (b->flush) {
> >             return b->flush(b, b->ctx);
> >         }
> >     }
> >     else {
> >     }
> >     return nbyte;
> >}
> 
> If you call apr_brigade_write on a brigade with no flush function 
> specified, then you're going to end up with a transient bucket in 
> your brigade.  It looks like check_brigade_flush needs to check 
> b->flush and create a heap bucket if it's NULL.  I thought about 
> having apr_brigade_write checking  b->flush before calling 
> check_brigade_flush, but that could lead to buffer overruns.

Good point.  I'll make that change.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message