httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_core.c http_protocol.c
Date Mon, 13 Nov 2000 22:52:19 GMT
stoddard    00/11/13 14:52:19

  Modified:    src/main http_core.c http_protocol.c
  Log:
  Update coalesce filter to use heap buckets rather than pool buckets. This should fix the
  mod_autoindex funky chunking behaviour until the ap_r* routines are reimplemented, at which
  time this filter should probably go away.
  
  Revision  Changes    Path
  1.215     +12 -10    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.214
  retrieving revision 1.215
  diff -u -r1.214 -r1.215
  --- http_core.c	2000/11/13 14:19:41	1.214
  +++ http_core.c	2000/11/13 22:52:19	1.215
  @@ -91,7 +91,7 @@
   
   /* Make sure we don't write less than 4096 bytes at any one time.
    */
  -#define MIN_SIZE_TO_WRITE  9000
  +#define MIN_BYTES_TO_WRITE  9000
   
   /* LimitXMLRequestBody handling */
   #define AP_LIMIT_UNSET                  ((long) -1)
  @@ -2959,6 +2959,9 @@
    * non-contiguous buckets. For example, if a brigade contains 10 small 
    * buckets followed by a large bucket (or a pipe or file bucket) followed 
    * by more small buckets, only the first 10 buckets will be coalesced.
  + *
  + * Yack... Using heap buckets which is really inefficient (multiple byte moves)
  + * until we get heap bucket pooling in place.
    */
   typedef struct COALESCE_FILTER_CTX {
       char *buf;           /* Start of buffer */
  @@ -2966,7 +2969,6 @@
       apr_size_t cnt;     /* Number of bytes put in buf */
       apr_size_t avail;   /* Number of bytes available in the buf */
   } coalesce_filter_ctx_t;
  -#define FILTER_BUFF_SIZE 8192
   #define MIN_BUCKET_SIZE 200
   static apr_status_t coalesce_filter(ap_filter_t *f, ap_bucket_brigade *b)
   {
  @@ -2978,7 +2980,7 @@
   
       if (ctx == NULL) {
           f->ctx = ctx = apr_pcalloc(p, sizeof(coalesce_filter_ctx_t));
  -        ctx->avail = FILTER_BUFF_SIZE;
  +        ctx->avail = MIN_BYTES_TO_WRITE;
       }
   
       if (ctx->cnt) {
  @@ -3008,7 +3010,7 @@
               if ((n < MIN_BUCKET_SIZE) && (n < ctx->avail)) {
                   /* Coalesce this bucket into the buffer */
                   if (ctx->buf == NULL) {
  -                    ctx->buf = apr_palloc(p, FILTER_BUFF_SIZE);
  +                    ctx->buf = apr_palloc(p, MIN_BYTES_TO_WRITE);
                       ctx->cur = ctx->buf;
                       ctx->cnt = 0;
                   }
  @@ -3051,13 +3053,13 @@
       }
   
       if (pass_the_brigade) {
  -        /* Insert ctx->buf into the correct spotin the brigade */
  +        /* Insert ctx->buf into the correct spot in the brigade */
           if (insert_first) {
  -            e = ap_bucket_create_pool(ctx->buf, ctx->cnt, p);
  +            e = ap_bucket_create_heap(ctx->buf, ctx->cnt, 1, NULL);
               AP_BRIGADE_INSERT_HEAD(b, e);
           } 
           else if (insert_before) {
  -            e = ap_bucket_create_pool(ctx->buf, ctx->cnt, p);
  +            e = ap_bucket_create_heap(ctx->buf, ctx->cnt, 1, NULL);
               AP_BUCKET_INSERT_BEFORE(e, insert_before);
               AP_BUCKET_REMOVE(insert_before);
               ap_bucket_destroy(insert_before);
  @@ -3072,7 +3074,7 @@
           if (ctx) {
               ctx->cur = ctx->buf;
               ctx->cnt = 0;
  -            ctx->avail = FILTER_BUFF_SIZE;
  +            ctx->avail = MIN_BYTES_TO_WRITE;
           }
       }
       else {
  @@ -3306,7 +3308,7 @@
           /* Completed iterating over the brigades, now determine if we want to
            * buffer the brigade or send the brigade out on the network
            */
  -        if ((!fd && (!more) && (nbytes < MIN_SIZE_TO_WRITE) &&
!AP_BUCKET_IS_FLUSH(e))
  +        if ((!fd && (!more) && (nbytes < MIN_BYTES_TO_WRITE) &&
!AP_BUCKET_IS_FLUSH(e))
               || (AP_BUCKET_IS_EOS(e) && c->keepalive)) {
               
               /* NEVER save an EOS in here.  If we are saving a brigade with an
  @@ -3469,7 +3471,7 @@
       ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter, 
                                 AP_FTYPE_CONTENT);
       ap_register_output_filter("CHUNK", chunk_filter, AP_FTYPE_TRANSCODE);
  -    ap_register_output_filter("COALESCE", coalesce_filter, AP_FTYPE_CONNECTION);
  +    ap_register_output_filter("COALESCE", coalesce_filter, AP_FTYPE_CONTENT);
   }
   
   AP_DECLARE_DATA module core_module = {
  
  
  
  1.242     +6 -3      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.241
  retrieving revision 1.242
  diff -u -r1.241 -r1.242
  --- http_protocol.c	2000/11/13 20:23:41	1.241
  +++ http_protocol.c	2000/11/13 22:52:19	1.242
  @@ -2458,9 +2458,7 @@
       if (r->chunked) {
           apr_table_mergen(r->headers_out, "Transfer-Encoding", "chunked");
           apr_table_unset(r->headers_out, "Content-Length");
  -        /* Disable the buffer filter because it may be masking bugs in the 
  -         * bucket brigade code  */
  -/*      ap_add_output_filter("COALESCE", NULL, r, r->connection); */
  +
       }
   
       apr_table_setn(r->headers_out, "Content-Type", make_content_type(r,
  @@ -2519,6 +2517,11 @@
       ap_pass_brigade(f->next, b2);
   
       if (r->chunked) {
  +        /* The coalesce filter is useful to coalesce content from the ap_r*
  +         * routines. Removing this filter should not break the server.
  +         */
  +        ap_add_output_filter("COALESCE", NULL, r, r->connection);
  +
           /* We can't add this filter until we have already sent the headers.
            * If we add it before this point, then the headers will be chunked
            * as well, and that is just wrong.
  
  
  

Mime
View raw message