httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@locus.apache.org
Subject cvs commit: apache-2.0/src/modules/standard mod_cgi.c
Date Fri, 08 Sep 2000 10:16:18 GMT
fanf        00/09/08 03:16:16

  Modified:    src/ap   ap_buckets.c ap_buckets_pipe.c
                        ap_buckets_refcount.c ap_buckets_simple.c
               src/include ap_buckets.h
               src/main http_core.c http_protocol.c util_filter.c
               src/modules/standard mod_cgi.c
  Log:
  Reduce the manualarity of managing bucket brigade lists by using the
  new AP_RING macros. Most of this commit is fairly pedestrian as you
  would expect, but I had to redo the chunking filter because of the
  amount of pointer juggling it did. I have done some minimal testing
  of this patch and it seems to work.
  
  Revision  Changes    Path
  1.13      +39 -54    apache-2.0/src/ap/ap_buckets.c
  
  Index: ap_buckets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- ap_buckets.c	2000/09/04 05:42:19	1.12
  +++ ap_buckets.c	2000/09/08 10:15:57	1.13
  @@ -71,26 +71,23 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t ap_bucket_list_destroy(ap_bucket *e)
  -{
  -    ap_bucket *cur = e;
  -    ap_bucket *next;
  -
  -    while (cur) {
  -        next = cur->next;
  -        ap_bucket_destroy(cur);
  -        cur = next;
  -    }
  -    return APR_SUCCESS;
  -}
   static apr_status_t ap_brigade_cleanup(void *data)
   {
       ap_bucket_brigade *b = data;
  +    ap_bucket *e;
   
  -    ap_bucket_list_destroy(b->head);
  -    /* The brigade itself is allocated out of a pool, so we don't actually 
  -     * want to free it.  If we did, we would do that free() here.
  +    /*
  +     * Bah! We can't use AP_RING_FOREACH here because this bucket has
  +     * gone away when we dig inside it to get the next one.
        */
  +    while (!AP_RING_EMPTY(&b->list, ap_bucket, link)) {
  +	e = AP_RING_FIRST(&b->list);
  +	AP_RING_REMOVE(e, link);
  +	ap_bucket_destroy(e);
  +    }
  +    /*
  +     * We don't need to free(bb) because it's allocated from a pool.
  +     */
       return APR_SUCCESS;
   }
   API_EXPORT(apr_status_t) ap_brigade_destroy(ap_bucket_brigade *b)
  @@ -105,64 +102,52 @@
   
       b = apr_palloc(p, sizeof(*b));
       b->p = p;
  -    b->head = b->tail = NULL;
  +    AP_RING_INIT(&b->list, ap_bucket, link);
   
       apr_register_cleanup(b->p, b, ap_brigade_cleanup, ap_brigade_cleanup);
       return b;
   }
   
  -API_EXPORT(void) ap_brigade_append_buckets(ap_bucket_brigade *b, 
  -                                                  ap_bucket *e)
  +API_EXPORT(void) ap_brigade_add_bucket(ap_bucket_brigade *b, 
  +				       ap_bucket *e)
   {
  -    ap_bucket *cur = e;
  +    AP_RING_INSERT_TAIL(&b->list, e, link);
  +}
   
  -    if (b->tail) {
  -        b->tail->next = e;
  -        e->prev = b->tail;
  -        while (cur->next) {
  -           cur = cur->next;
  -        }
  -        b->tail = cur;
  -    }
  -    else {
  -        b->head = b->tail = e;
  -    }
  +API_EXPORT(void) ap_brigade_catenate(ap_bucket_brigade *a, 
  +				     ap_bucket_brigade *b)
  +{
  +    AP_RING_CONCAT(&a->list, &b->list, ap_bucket, link);
  +}
  +
  +API_EXPORT(ap_bucket_brigade *) ap_brigade_split(ap_bucket_brigade *b,
  +						 ap_bucket *e)
  +{
  +    ap_bucket_brigade *a;
  +    ap_bucket *f;
  +    a = ap_brigade_create(b->p);
  +    f = AP_RING_LAST(&b->list);
  +    AP_RING_UNSPLICE(e, f, link);
  +    AP_RING_SPLICE_HEAD(&a->list, e, f, link);
  +    return a;
   }
   
   API_EXPORT(int) ap_brigade_to_iovec(ap_bucket_brigade *b, 
  -                                           struct iovec *vec, int nvec)
  +				    struct iovec *vec, int nvec)
   {
       ap_bucket *e;
       struct iovec *orig;
   
       orig = vec;
  -    e = b->head;
  -    while (e && nvec) {
  +    AP_RING_FOREACH(e, &b->list, ap_bucket, link) {
  +	if (nvec-- == 0)
  +            break;
   	e->read(e, (const char **)&vec->iov_base, &vec->iov_len, 0);
  -	e = e->next;
  -	--nvec;
   	++vec;
       }
       return vec - orig;
   }
   
  -API_EXPORT(void) ap_brigade_catenate(ap_bucket_brigade *a, 
  -                                            ap_bucket_brigade *b)
  -{
  -    if (b->head) {
  -        if (a->tail) {
  -            a->tail->next = b->head;
  -        }
  -        b->head->prev = a->tail;
  -	a->tail = b->tail;
  -        if (!a->head) {
  -            a->head = b->head;
  -        }
  -	b->head = NULL;
  -	b->tail = b->head;
  -    }
  -}
  -
   API_EXPORT(int) ap_brigade_vputstrs(ap_bucket_brigade *b, va_list va)
   {
       ap_bucket *r;
  @@ -184,7 +169,7 @@
           }
           k += i;
   
  -        ap_brigade_append_buckets(b, r);
  +        ap_brigade_add_bucket(b, r);
       }
   
       return k;
  @@ -213,7 +198,7 @@
       res = apr_vsnprintf(buf, 4096, fmt, va);
   
       r = ap_bucket_create_heap(buf, strlen(buf), 1, NULL);
  -    ap_brigade_append_buckets(b, r);
  +    ap_brigade_add_bucket(b, r);
   
       return res;
   }
  
  
  
  1.7       +1 -7      apache-2.0/src/ap/ap_buckets_pipe.c
  
  Index: ap_buckets_pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_pipe.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- ap_buckets_pipe.c	2000/09/05 19:24:13	1.6
  +++ ap_buckets_pipe.c	2000/09/08 10:15:57	1.7
  @@ -88,13 +88,7 @@
       if (*len > 0) {
           a = ap_bucket_create_pipe(bd->thepipe);
           b = ap_bucket_make_heap(b, buf, *len, 0, NULL);
  -	
  -        if (b->next) {
  -            b->next->prev = a;
  -        }
  -        a->next = b->next;
  -        b->next = a;
  -        a->prev = b;
  +	AP_RING_INSERT_AFTER(a, b, link);
       }
       return APR_SUCCESS;
   }
  
  
  
  1.4       +1 -6      apache-2.0/src/ap/ap_buckets_refcount.c
  
  Index: ap_buckets_refcount.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_refcount.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- ap_buckets_refcount.c	2000/08/22 03:20:44	1.3
  +++ ap_buckets_refcount.c	2000/09/08 10:15:58	1.4
  @@ -90,12 +90,7 @@
       b->length -= point;
       bd->start += point;
   
  -    if (a->next) {
  -	a->next->prev = b;
  -    }
  -    b->next = a->next;
  -    b->prev = a;
  -    a->next = b;
  +    AP_RING_INSERT_AFTER(a, b, link);
   
       return APR_SUCCESS;
   }
  
  
  
  1.3       +1 -6      apache-2.0/src/ap/ap_buckets_simple.c
  
  Index: ap_buckets_simple.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/ap/ap_buckets_simple.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- ap_buckets_simple.c	2000/08/19 16:54:45	1.2
  +++ ap_buckets_simple.c	2000/09/08 10:15:59	1.3
  @@ -89,12 +89,7 @@
       b->length -= point;
       bd->start += point;
   
  -    if (a->next) {
  -	a->next->prev = b;
  -    }
  -    b->next = a->next;
  -    b->prev = a;
  -    a->next = b;
  +    AP_RING_INSERT_AFTER(a, b, link);
   
       return APR_SUCCESS;
   }
  
  
  
  1.21      +55 -43    apache-2.0/src/include/ap_buckets.h
  
  Index: ap_buckets.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/ap_buckets.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -u -r1.20 -r1.21
  --- ap_buckets.h	2000/09/07 10:24:41	1.20
  +++ ap_buckets.h	2000/09/08 10:16:05	1.21
  @@ -59,6 +59,7 @@
   #include "apr_general.h"
   #include "apr_mmap.h"
   #include "apr_errno.h"
  +#include "ap_ring.h"
   #ifdef HAVE_SYS_UIO_H
   #include <sys/uio.h>	/* for struct iovec */
   #endif
  @@ -70,18 +71,18 @@
    * @package Bucket Brigades
    */
   
  -typedef struct ap_bucket_brigade ap_bucket_brigade;
  -
  -/* The basic concept behind bucket brigades.....
  +/*
  + * The basic concept behind bucket brigades.....
    *
  - * A bucket brigade is simply a doubly linked list of buckets, so
  - * we aren't limited to inserting at the front and removing at the
  - * end.
  + * A bucket brigade is a doubly linked list of buckets, so we
  + * aren't limited to inserting at the front and removing at the end.
  + * Buckets are only passed around as members of a brigade, although
  + * singleton buckets can occur for short periods of time.
    *
  - * Buckets are just data stores.  They can be files, mmap areas, or just
  - * pre-allocated memory.  The point of buckets is to store data.  Along with
  - * that data, come some functions to access it.  The functions are relatively
  - * simple, read, split, setaside, and destroy.
  + * Buckets are data stores. They can be files, mmap areas, or just
  + * pre-allocated memory. Along with that data come some functions to
  + * access it. The functions are relatively simple: read, split,
  + * setaside, and destroy.
    *
    * read reads a string of data.  Currently, it assumes we read all of the 
    * data in the bucket.  This should be changed to only read the specified 
  @@ -122,6 +123,12 @@
   
   #define AP_END_OF_BRIGADE       -1
   
  +/**
  + * Forward declaration of the main types.
  + */
  +
  +typedef struct ap_bucket_brigade ap_bucket_brigade;
  +
   typedef struct ap_bucket ap_bucket;
   
   /**
  @@ -134,15 +141,13 @@
    * after a split) the data is freed when the last bucket goes away.
    */
   struct ap_bucket {
  +    /** Links to the rest of the brigade */
  +    AP_RING_ENTRY(ap_bucket) link;
       /** The type of bucket.  These types can be found in the enumerated
        *  type above */
       ap_bucket_type_e type;
       /** type-dependent data hangs off this pointer */
       void *data;	
  -    /** The next bucket in the brigade */
  -    ap_bucket *next;
  -    /** The previous bucket in the brigade */
  -    ap_bucket *prev;
       /** The length of the data in the bucket.  This could have been implemented
        *  with a function, but this is an optimization, because the most
        *  common thing to do will be to get the length.  If the length is unknown,
  @@ -198,10 +203,8 @@
        *  the destroying function is responsible for killing the cleanup.
        */
       apr_pool_t *p;
  -    /** The start of the bucket list. */
  -    ap_bucket *head;
  -    /** The end of the bucket list. */
  -    ap_bucket *tail;
  +    /** The buckets in the brigade are on this list. */
  +    AP_RING_HEAD(, ap_bucket) list;
   };
   
   /**
  @@ -311,7 +314,7 @@
   /**
    * Create a new bucket brigade.  The bucket brigade is originally empty.
    * @param The pool to associate with the brigade.  Data is not allocated out
  -q *        of the pool, but a cleanup is registered.
  + *        of the pool, but a cleanup is registered.
    * @return The empty bucket brigade
    * @deffunc ap_bucket_brigade *ap_brigade_create(apr_pool_t *p)
    */
  @@ -326,23 +329,45 @@
   API_EXPORT(apr_status_t) ap_brigade_destroy(ap_bucket_brigade *b);
   
   /**
  - * append bucket(s) to a bucket_brigade.  This is the correct way to add
  - * buckets to the end of a bucket briagdes bucket list.  This will accept
  - * a list of buckets of any length.
  - * @param b The bucket brigade to append to
  - * @param e The bucket list to append
  + * add a bucket to the end of a bucket_brigade.
  + * @param b The bucket brigade to add the bucket to
  + * @param e The bucket list to add
    * @deffunc void ap_brigade_append_buckets(ap_bucket_brigade *b, ap_bucket *e)
  + */
  +API_EXPORT(void) ap_brigade_add_bucket(ap_bucket_brigade *b,
  +				       ap_bucket *e);
  +
  +/**
  + * Concatenate bucket_brigade b onto the end of bucket_brigade a,
  + * emptying bucket_brigade b in the process. Neither bucket brigade
  + * can be NULL, but either one of them can be emtpy when calling this
  + * function.
  + * @param a The brigade to catenate to.
  + * @param b The brigade to add to a.  This brigade will be empty on return
  + * @deffunc void ap_brigade_catenate(ap_bucket_brigade *a, ap_bucket_brigade *b)
  + */
  +API_EXPORT(void) ap_brigade_catenate(ap_bucket_brigade *a, 
  +				     ap_bucket_brigade *b);
  +
  +/**
  + * Split a bucket brigade into two, such that the given bucket is the
  + * first in the new bucket brigade. This function is useful when a
  + * filter wants to pass only the initial part of a brigade to the next
  + * filter.
  + * @param b The brigade to split
  + * @param e The first element of the new brigade
  + * @return The new brigade
  + * @deffunc ap_bucket_brigade *ap_brigade_split(ap_bucket_brigade *b, ap_bucket *e)
    */
  -API_EXPORT(void) ap_brigade_append_buckets(ap_bucket_brigade *b,
  -                                                  ap_bucket *e);
  +API_EXPORT(ap_bucket_brigade *) ap_brigade_split(ap_bucket_brigade *b,
  +						 ap_bucket *e);
   
   /**
    * consume nbytes from beginning of b -- call ap_bucket_destroy as
    * appropriate, and/or modify start on last element 
    * @param b The brigade to consume data from
    * @param nbytes The number of bytes to consume
  - * @deffunc void ap_brigade_consume(ap_bucket_brigade *b, int nbytes)
  - */
  + * @deffunc void ap_brigade_consume(ap_bucket_brigade *b, int nbytes) */
   API_EXPORT(void) ap_brigade_consume(ap_bucket_brigade *b, int nbytes);
   
   /**
  @@ -356,19 +381,7 @@
    * @deffunc int ap_brigade_to_iovec(ap_bucket_brigade *b, struct iovec *vec, int nvec);
    */
   API_EXPORT(int) ap_brigade_to_iovec(ap_bucket_brigade *b, 
  -                                           struct iovec *vec, int nvec);
  -
  -/**
  - * Concatenate bucket_brigade b onto the end of bucket_brigade a,
  - * emptying bucket_brigade b in the process. Neither bucket brigade
  - * can be NULL, but either one of them can be emtpy when calling this
  - * function.
  - * @param a The brigade to catenate to.
  - * @param b The brigade to add to a.  This brigade will be empty on return
  - * @deffunc void ap_brigade_catenate(ap_bucket_brigade *a, ap_bucket_brigade *b)
  - */
  -API_EXPORT(void) ap_brigade_catenate(ap_bucket_brigade *a, 
  -                                            ap_bucket_brigade *b);
  +				    struct iovec *vec, int nvec);
   
   /**
    * This function writes a list of strings into a bucket brigade.  We just 
  @@ -489,8 +502,7 @@
   	    free(b);				\
   	    return NULL;			\
   	}					\
  -	ap__b->next = NULL;			\
  -	ap__b->prev = NULL;			\
  +	AP_RING_ELEM_INIT(ap__b, link);		\
   	return ap__b;				\
       } while(0)
   
  
  
  
  1.113     +78 -87    apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -u -r1.112 -r1.113
  --- http_core.c	2000/09/07 23:51:36	1.112
  +++ http_core.c	2000/09/08 10:16:08	1.113
  @@ -2914,91 +2914,79 @@
       return OK;
   }
   
  -/* This is an incredibly stupid chunking filter.  This will need to be somewhat
  - * smart about when it actually sends the data, but this implements some sort
  - * of chunking for right now.
  +/*
  + * Turn a bucket brigade into a properly-formatted HTTP/1.1 chunk
  + * before passing it down to the next filter.
    */
  -static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b)
  +static apr_status_t pass_chunk(ap_filter_t *f, ap_bucket_brigade *b,
  +			       apr_off_t bytes, int eos)
   {
  -    ap_bucket *dptr = b->head, *lb, *next, *tail;
  -    int len = 0, cur_len;
  -    char lenstr[sizeof("ffffffff\r\n")];
  -    const char *cur_str;
  -    int hit_eos = 0;
  -    apr_status_t rv = APR_SUCCESS;
  +    char chunk_hdr[20]; /* enough space for the snprintf below */
  +    size_t hdr_len;
  +    ap_bucket *e;
   
  -    while (dptr) {
  -        if (dptr->type == AP_BUCKET_EOS) {
  -            hit_eos = 1;
  -            break;
  -        } 
  -        else if (dptr->length == -1) { /* indeterminate (e.g., a pipe) */
  -            dptr->read(dptr, &cur_str, &cur_len, 0);
  -            if (cur_len) {
  -                len += cur_len;
  -                /* write out what we have so far */
  -                apr_snprintf(lenstr, sizeof(lenstr), "%x\r\n", len);
  -                lb = ap_bucket_create_transient(lenstr, strlen(lenstr));
  -                lb->next = b->head;
  -                lb->next->prev = lb;
  -                b->head = lb;
  -                next = dptr->next;
  -                tail = b->tail;
  -                b->tail = ap_bucket_create_transient("\r\n", 2);
  -                dptr->next = b->tail;
  -                b->tail->prev = dptr;
  -                rv = ap_pass_brigade(f->next, b);
  -                if (rv != APR_SUCCESS) {
  -                    return rv;
  -                }
  -                /* start a new brigade */
  -                len = 0;
  -                b = ap_brigade_create(f->r->pool);
  -                dptr = next;
  -                b->head = dptr;
  -                b->tail = tail;
  -            }
  -            else {
  -                dptr = dptr->next;
  -            }
  -        }
  -        else {
  -            len += dptr->length;
  -            dptr = dptr->next;
  -        }
  +    if (bytes == 0) {
  +	return APR_SUCCESS;
       }
  -    if (len) {
  -        apr_snprintf(lenstr, sizeof(lenstr), "%x\r\n", len);
  -        lb = ap_bucket_create_transient(lenstr, strlen(lenstr));
  -        lb->next = b->head;
  -        lb->next->prev = lb;
  -        b->head = lb;
  -        lb = ap_bucket_create_transient("\r\n", 2);
  -        if (hit_eos) {
  -            b->tail->prev->next = lb;
  -            lb->prev = b->tail->prev;
  -            b->tail->prev = lb;
  -            lb->next = b->tail;
  -        }
  -        else {
  -            ap_brigade_append_buckets(b, lb);
  -        }
  +    hdr_len = apr_snprintf(chunk_hdr, sizeof(chunk_hdr), "%qx" CRLF, bytes);
  +    e = ap_bucket_create_transient(chunk_hdr, hdr_len);
  +    AP_RING_INSERT_HEAD(&b->list, e, link);
  +    if (eos) {
  +	/* any trailer should go between the last two CRLFs */
  +	e = ap_bucket_create_immortal(CRLF "0" CRLF CRLF, 7);
  +	AP_RING_INSERT_BEFORE(AP_RING_LAST(&b->list), e, link);
  +    } else {
  +	e = ap_bucket_create_immortal(CRLF, 2);
  +	AP_RING_INSERT_TAIL(&b->list, e, link);
       }
  -    if (hit_eos) {
  -        lb = ap_bucket_create_transient("0\r\n\r\n", 5);
  -        if (b->tail->prev) {
  -            b->tail->prev->next = lb;
  -        }
  -        lb->prev = b->tail->prev;
  -        b->tail->prev = lb;
  -        lb->next = b->tail;
  -        if (b->head == b->tail) {
  -            b->head = lb;
  -        }
  -    }
       return ap_pass_brigade(f->next, b);
   }
   
  +/*
  + * HTTP/1.1 chunked transfer encoding filter.
  + */
  +static apr_status_t chunk_filter(ap_filter_t *f, ap_bucket_brigade *b)
  +{
  +    ap_bucket_brigade *more = NULL;
  +    ap_bucket *e;
  +    apr_status_t rv;
  +
  +    for (more = NULL; b; b = more, more = NULL) {
  +	apr_off_t bytes = 0;
  +	int eos = 0;
  +	AP_RING_FOREACH(e, &b->list, ap_bucket, link) {
  +	    if (e->type == AP_BUCKET_EOS) {
  +		/* assume it is the last one in the brigade */
  +		eos = 1;
  +		break;
  +	    }
  +	    else if (e->length == -1) { /* indeterminate (e.g., a pipe) */
  +		const char *data;
  +		apr_ssize_t len;
  +		rv = e->read(e, &data, &len, 1);
  +		if (rv != APR_SUCCESS) {
  +		    return rv;
  +		}
  +		bytes += len;
  +		more = ap_brigade_split(b, AP_RING_NEXT(e, link));
  +		break;
  +	    }
  +	    else {
  +		bytes += e->length;
  +	    }
  +	}
  +	/*
  +	 * XXX: if there aren't very many bytes at this point it may
  +	 * be a good idea to set them aside and return for more.
  +	 */
  +	rv = pass_chunk(f, b, bytes, eos);
  +	if (rv != APR_SUCCESS || eos) {
  +	    return rv;
  +	}
  +    }
  +    return APR_SUCCESS;
  +}
  +
   /* Default filter.  This filter should almost always be used.  Its only job
    * is to send the headers if they haven't already been sent, and then send
    * the actual data.  To send the data, we create an iovec out of the bucket
  @@ -3017,11 +3005,11 @@
   #endif
       apr_status_t rv;
       apr_ssize_t bytes_sent = 0;
  -    ap_bucket *dptr = b->head;
  +    ap_bucket *e;
       int len = 0, written;
       const char *str;
  -
  -#if 0
  +    
  +#if 0 /* XXX: bit rot! */
       /* This will all be needed once BUFF is removed from the code */
       /* At this point we need to discover if there was any data saved from
        * the last call to core_filter.
  @@ -3042,16 +3030,19 @@
       } 
       else {
   #endif
  -    while (dptr->read(dptr, &str, &len, 0) != AP_END_OF_BRIGADE) {
  -        if ((rv = ap_bwrite(f->r->connection->client, str, len, &written))
  -            != APR_SUCCESS) {
  +    AP_RING_FOREACH(e, &b->list, ap_bucket, link) {
  +	rv = e->read(e, &str, &len, 0);
  +	if (rv != APR_SUCCESS) {
               return rv;
           }
  -        dptr = dptr->next;
  -        bytes_sent += written;
  -        if (!dptr) {
  -            break;
  +	if (len == AP_END_OF_BRIGADE) {
  +	    break;
  +	}
  +        rv = ap_bwrite(f->r->connection->client, str, len, &written);
  +	if (rv != APR_SUCCESS) {
  +            return rv;
           }
  +        bytes_sent += written;
       }
       ap_brigade_destroy(b);
       /* This line will go away as soon as the BUFFs are removed */
  
  
  
  1.119     +5 -5      apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -u -r1.118 -r1.119
  --- http_protocol.c	2000/08/30 01:09:03	1.118
  +++ http_protocol.c	2000/09/08 10:16:09	1.119
  @@ -1329,7 +1329,7 @@
       ap_bucket_brigade *bb;
   
       bb = ap_brigade_create(r->pool);
  -    ap_brigade_append_buckets(bb, ap_bucket_create_eos());
  +    ap_brigade_add_bucket(bb, ap_bucket_create_eos());
       ap_pass_brigade(r->filters, bb);
   }
   
  @@ -2519,7 +2519,7 @@
        * until after the commit to actually write the code.
        */
       bb = ap_brigade_create(r->pool);
  -    ap_brigade_append_buckets(bb, ap_bucket_create_mmap(mm, 0, mm->size));
  +    ap_brigade_add_bucket(bb, ap_bucket_create_mmap(mm, 0, mm->size));
       ap_pass_brigade(r->filters, bb);
   
       return mm->size; /* XXX - change API to report apr_status_t? */
  @@ -2535,7 +2535,7 @@
           return EOF;
   
       bb = ap_brigade_create(r->pool);
  -    ap_brigade_append_buckets(bb, ap_bucket_create_transient(&c2, 1)); 
  +    ap_brigade_add_bucket(bb, ap_bucket_create_transient(&c2, 1)); 
       ap_pass_brigade(r->filters, bb);
   
       return c;
  @@ -2553,7 +2553,7 @@
   
       len = strlen(str);
       bb = ap_brigade_create(r->pool);
  -    ap_brigade_append_buckets(bb, ap_bucket_create_transient(str, len));
  +    ap_brigade_add_bucket(bb, ap_bucket_create_transient(str, len));
       ap_pass_brigade(r->filters, bb);
   
       return len;
  @@ -2569,7 +2569,7 @@
           return 0;
   
       bb = ap_brigade_create(r->pool);
  -    ap_brigade_append_buckets(bb, ap_bucket_create_transient(buf, nbyte)); 
  +    ap_brigade_add_bucket(bb, ap_bucket_create_transient(buf, nbyte)); 
       ap_pass_brigade(r->filters, bb);
       return nbyte;
   }
  
  
  
  1.13      +3 -9      apache-2.0/src/main/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_filter.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- util_filter.c	2000/08/30 01:09:09	1.12
  +++ util_filter.c	2000/09/08 10:16:10	1.13
  @@ -189,7 +189,7 @@
   API_EXPORT(void) ap_save_data_to_filter(ap_filter_t *f, ap_bucket_brigade **b)
   {
       ap_bucket_brigade *bb = (ap_bucket_brigade *)f->ctx;
  -    ap_bucket *dptr = bb->head;
  +    ap_bucket *e;
   
       /* If have never stored any data in the filter, then we had better
        * create an empty bucket brigade so that we can concat.
  @@ -198,15 +198,9 @@
           bb = ap_brigade_create(f->r->pool);
       }
       
  -    while (dptr) {
  -        if (dptr->setaside) {
  -            dptr->setaside(dptr);
  -        }
  +    AP_RING_FOREACH(e, &bb->list, ap_bucket, link) {
  +	e->setaside(e);
       }
  -
  -    /* Apend b to bb.  This means b is now empty, and we can destory it safely. 
  -     */
       ap_brigade_catenate(bb, *b);
  -    ap_brigade_destroy(*b);
       f->ctx = bb;
   }
  
  
  
  1.61      +4 -4      apache-2.0/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -u -r1.60 -r1.61
  --- mod_cgi.c	2000/08/26 19:45:15	1.60
  +++ mod_cgi.c	2000/09/08 10:16:14	1.61
  @@ -656,8 +656,8 @@
   	ap_send_http_header(r);
   	if (!r->header_only) {
               bb = ap_brigade_create(r->pool);
  -            ap_brigade_append_buckets(bb, ap_bucket_create_pipe(script_in));
  -            ap_brigade_append_buckets(bb, ap_bucket_create_eos());
  +            ap_brigade_add_bucket(bb, ap_bucket_create_pipe(script_in));
  +            ap_brigade_add_bucket(bb, ap_bucket_create_eos());
   	}
           ap_pass_brigade(r->filters, bb);
   
  @@ -667,8 +667,8 @@
   
       if (script_in && nph) {
           bb = ap_brigade_create(r->pool);
  -        ap_brigade_append_buckets(bb, ap_bucket_create_pipe(script_in));
  -        ap_brigade_append_buckets(bb, ap_bucket_create_eos());
  +        ap_brigade_add_bucket(bb, ap_bucket_create_pipe(script_in));
  +        ap_brigade_add_bucket(bb, ap_bucket_create_eos());
           ap_pass_brigade(r->filters, bb);
       }
   
  
  
  

Mime
View raw message