httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_protocol.c
Date Wed, 08 Nov 2000 20:00:41 GMT
trawick     00/11/08 12:00:39

  Modified:    src/main http_protocol.c
  Log:
  In the content-length+bytes-sent filter, only set the content length
  if we decided to do so initially *and* we've seen all the data.
  
  Prior to this change, for a http/1.1 request to mod_autoindex, the
  unconditional call to ap_set_content_length() gave us the wrong
  value (only taking into account the first brigade) and disabled
  chunking.
  
  Revision  Changes    Path
  1.235     +15 -14    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.234
  retrieving revision 1.235
  diff -u -r1.234 -r1.235
  --- http_protocol.c	2000/11/08 11:22:07	1.234
  +++ http_protocol.c	2000/11/08 20:00:35	1.235
  @@ -2194,7 +2194,8 @@
   
   /* This filter computes the content length, but it also computes the number
    * of bytes sent to the client.  This means that this filter will always run
  -through all of the buckets in all brigades */
  + * through all of the buckets in all brigades 
  + */
   AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f,
                                                                 ap_bucket_brigade *b)
   {
  @@ -2240,7 +2241,6 @@
           apr_size_t length;
   
           if (AP_BUCKET_IS_EOS(e) || AP_BUCKET_IS_FLUSH(e)) {
  -            ctx->hold_data = 0;
               send_it = 1;
           }
           rv = ap_bucket_read(e, &ignored, &length, AP_BLOCK_READ);
  @@ -2249,21 +2249,22 @@
           }
           r->bytes_sent += length;
       }
  -
  -    /* save the brigade; we can't pass any data to the next
  -     * filter until we have the entire content length
  -     */
  -    if (ctx->hold_data && !send_it) {
  -        ap_save_brigade(f, &ctx->saved, &b);
  -        return APR_SUCCESS;
  -    }
   
  -    if (ctx->saved) {
  -        AP_BRIGADE_CONCAT(ctx->saved, b);
  -        b = ctx->saved;
  +    if (ctx->hold_data) { /* calculating content length? */
  +        /* save the brigade; we can't pass any data to the next
  +         * filter until we have the entire content length
  +         */
  +        if (!send_it) {
  +            ap_save_brigade(f, &ctx->saved, &b);
  +            return APR_SUCCESS;
  +        }
  +        if (ctx->saved) {
  +            AP_BRIGADE_CONCAT(ctx->saved, b);
  +            b = ctx->saved;
  +        }
  +        ap_set_content_length(r, r->bytes_sent);
       }
   
  -    ap_set_content_length(r, r->bytes_sent);
       return ap_pass_brigade(f->next, b);
   }
   
  
  
  

Mime
View raw message