httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwool...@apache.org
Subject cvs commit: httpd-2.0/server error_bucket.c
Date Fri, 31 May 2002 05:03:09 GMT
jwoolley    2002/05/30 22:03:09

  Modified:    include  http_protocol.h
               server   error_bucket.c
  Log:
  fix some major badness: error buckets *cannot* use simple_copy because
  they're not simple buckets.  they have a private data structure which
  gets freed.  if you're going to copy them and share whatever ->data points
  to (which is what simple_copy does), you have to refcount the structure,
  which is the whole point of apr_bucket_refcount and apr_bucket_shared_copy.
  
  Revision  Changes    Path
  1.81      +2 -0      httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -d -u -r1.80 -r1.81
  --- http_protocol.h	30 May 2002 21:08:21 -0000	1.80
  +++ http_protocol.h	31 May 2002 05:03:09 -0000	1.81
  @@ -658,6 +658,8 @@
    * first brigade to be sent from a given filter.
    */
   struct ap_bucket_error {
  +    /** Number of buckets using this memory */
  +    apr_bucket_refcount refcount;
       /** The error code */
       int status;
       /** The error string */
  
  
  
  1.15      +12 -5     httpd-2.0/server/error_bucket.c
  
  Index: error_bucket.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/error_bucket.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -u -r1.14 -r1.15
  --- error_bucket.c	30 May 2002 21:09:23 -0000	1.14
  +++ error_bucket.c	31 May 2002 05:03:09 -0000	1.15
  @@ -67,6 +67,15 @@
       return APR_SUCCESS;
   }
   
  +static void error_bucket_destroy(void *data)
  +{
  +    ap_bucket_error *h = data;
  +
  +    if (apr_bucket_shared_destroy(h)) {
  +        apr_bucket_free(h);
  +    }
  +}
  +
   AP_DECLARE(apr_bucket *) ap_bucket_error_make(apr_bucket *b, int error,
                                                 const char *buf, apr_pool_t *p)
   {
  @@ -76,10 +85,8 @@
       h->status = error;
       h->data = (buf) ? apr_pstrdup(p, buf) : NULL;
   
  -    b->length = 0;
  -    b->start  = 0;
  +    b = apr_bucket_shared_make(b, h, 0, 0);
       b->type = &ap_bucket_type_error;
  -    b->data = h;
       return b;
   }
   
  @@ -97,9 +104,9 @@
   
   AP_DECLARE_DATA const apr_bucket_type_t ap_bucket_type_error = {
       "ERROR", 5,
  -    apr_bucket_free,
  +    error_bucket_destroy,
       error_bucket_read,
       apr_bucket_setaside_notimpl,
       apr_bucket_split_notimpl,
  -    apr_bucket_simple_copy
  +    apr_bucket_shared_copy
   };
  
  
  

Mime
View raw message