httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Mon, 27 Aug 2001 20:48:00 GMT
trawick     01/08/27 13:48:00

  Modified:    .        CHANGES
               server   core.c
  Log:
  Fix a growing connection pool in core_output_filter() for
  keepalive requests.  We were allocating a brigade out of the
  connection pool; the number of these brigades allocated
  per connection was theoretically unlimited.
  
  Revision  Changes    Path
  1.337     +5 -1      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.336
  retrieving revision 1.337
  diff -u -r1.336 -r1.337
  --- CHANGES	2001/08/27 20:25:41	1.336
  +++ CHANGES	2001/08/27 20:47:59	1.337
  @@ -1,8 +1,12 @@
   Changes with Apache 2.0.25-dev
  +
  +  *) Fix a growing connection pool in core_output_filter() for 
  +     keepalive requests.  [Jeff Trawick]
  +
     *) Moved split_and_pass_pretag_buckets back to being a
        macro at Ryans's request. Removed the return from it
        by setting and returning a return code instead. Updated
  -     the code to check the return code from teh macro and
  +     the code to check the return code from the macro and
        do the right thing. [Paul J. Reder]
   
     *) Fix a segfault when a numeric value was received for Host:.
  
  
  
  1.51      +18 -2     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- core.c	2001/08/27 16:35:43	1.50
  +++ core.c	2001/08/27 20:48:00	1.51
  @@ -3070,6 +3070,10 @@
    */
   typedef struct CORE_OUTPUT_FILTER_CTX {
       apr_bucket_brigade *b;
  +    apr_pool_t *subpool; /* subpool of c->pool used for data saved after a
  +                          * request is finished
  +                          */
  +    int subpool_has_stuff; /* anything in the subpool? */
   } core_output_filter_ctx_t;
   
   #define MAX_IOVEC_TO_WRITE 16
  @@ -3191,6 +3195,11 @@
           if ((!fd && !more && 
               (nbytes + flen < AP_MIN_BYTES_TO_WRITE) && !APR_BUCKET_IS_FLUSH(last_e))
               || (nbytes + flen < AP_MIN_BYTES_TO_WRITE && APR_BUCKET_IS_EOS(last_e)
&& c->keepalive)) {
  +
  +            if (ctx->subpool == NULL) {
  +                apr_pool_create(&ctx->subpool, f->c->pool);
  +            }
  +
               /* NEVER save an EOS in here.  If we are saving a brigade with 
                * an EOS bucket, then we are doing keepalive connections, and 
                * we want to process to second request fully.
  @@ -3202,7 +3211,7 @@
                    * after the request_pool is cleared.
                    */ 
                   if (ctx->b == NULL) {
  -                    ctx->b = apr_brigade_create(f->c->pool);
  +                    ctx->b = apr_brigade_create(ctx->subpool);
                   }
   
                   APR_BRIGADE_FOREACH(bucket, b) {
  @@ -3227,11 +3236,13 @@
                           return rv;
                       }
                       apr_brigade_write(ctx->b, NULL, NULL, str, n);
  +                    ctx->subpool_has_stuff = 1;
                   }
                   apr_brigade_destroy(b);
               }
               else {
  -                ap_save_brigade(f, &ctx->b, &b, c->pool);
  +                ap_save_brigade(f, &ctx->b, &b, ctx->subpool);
  +                ctx->subpool_has_stuff = 1;
               }
               return APR_SUCCESS;
           }
  @@ -3304,6 +3315,11 @@
           b = more;
           more = NULL;
       }  /* end while () */
  +
  +    if (ctx->subpool && ctx->subpool_has_stuff) {
  +        apr_pool_clear(ctx->subpool);
  +        ctx->subpool_has_stuff = 0;
  +    }
   
       return APR_SUCCESS;
   }
  
  
  

Mime
View raw message