apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr-util/include apr_buckets.h
Date Fri, 10 Aug 2001 18:35:09 GMT
rbb         01/08/10 11:35:09

  Modified:    modules/http http_protocol.c
               include  apr_buckets.h
  Log:
  This should fix the remaining problems with POST.  Basically, we
  add a new macro, called APR_BRIGADE_NORMALIZE.  This macro searches
  all the buckets, and removes any zero length bucket.  They we can
  just use APR_BRIGADE_EMPTY to determine if our brigade has any data,
  and we can quickly call ap_get_brigade if it doesn't.
  
  Doug, please throw your battery of tests at this to make sure it works.
  
  Revision  Changes    Path
  1.352     +13 -1     httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.351
  retrieving revision 1.352
  diff -u -r1.351 -r1.352
  --- http_protocol.c	2001/08/09 04:56:23	1.351
  +++ http_protocol.c	2001/08/10 18:35:08	1.352
  @@ -677,9 +677,21 @@
              ### READBYTES bytes, and we wouldn't have to do any work.
           */
   
  +        APR_BRIGADE_NORMALIZE(ctx->b);
  +        if (APR_BRIGADE_EMPTY(ctx->b)) {
  +            if ((rv = ap_get_brigade(f->next, ctx->b, mode, readbytes)) != APR_SUCCESS)
{
  +                return rv;
  +            }
  +        }
  +            
           apr_brigade_partition(ctx->b, *readbytes, &e);
           APR_BRIGADE_CONCAT(b, ctx->b);
  -        ctx->b = apr_brigade_split(b, e);
  +        if (e != APR_BRIGADE_SENTINEL(ctx->b)) {
  +            ctx->b = apr_brigade_split(b, e);
  +        }
  +        else {
  +            ctx->b = NULL;
  +        }
           apr_brigade_length(b, 1, &total);
           *readbytes -= total;
   
  
  
  
  1.110     +17 -0     apr-util/include/apr_buckets.h
  
  Index: apr_buckets.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- apr_buckets.h	2001/08/10 00:10:50	1.109
  +++ apr_buckets.h	2001/08/10 18:35:08	1.110
  @@ -515,6 +515,23 @@
    */
   #define APR_BUCKET_IS_POOL(e)        (e->type == &apr_bucket_type_pool)
   
  +/**
  + * Remove all zero length buckets from the brigade.
  + * @param b The bucket brigade
  + */
  +#define APR_BRIGADE_NORMALIZE(b)       \
  +    do {  \
  +        apr_bucket *e; \
  +        e = APR_BRIGADE_FIRST(b); \
  +        if (e->length == 0) { \
  +            apr_bucket *d; \
  +            d = APR_BUCKET_NEXT(e); \
  +            apr_bucket_delete(e); \
  +            e = d; \
  +        } \
  +        e = APR_BUCKET_NEXT(e); \
  +    } while (e != APR_BRIGADE_SENTINEL(b)) 
  +
   /*
    * General-purpose reference counting for the various bucket types.
    *
  
  
  

Mime
View raw message