Return-Path: Mailing-List: contact apache-docs-help@apache.org; run by ezmlm Delivered-To: mailing list apache-docs@apache.org Received: (qmail 51070 invoked by uid 500); 22 Nov 2000 00:40:22 -0000 Delivered-To: apmail-httpd-docs-2.0-cvs@apache.org Received: (qmail 51060 invoked by uid 1092); 22 Nov 2000 00:40:21 -0000 Date: 22 Nov 2000 00:40:21 -0000 Message-ID: <20001122004021.51059.qmail@locus.apache.org> From: rbb@locus.apache.org To: httpd-docs-2.0-cvs@apache.org Subject: cvs commit: apache-2.0/src/include http_core.h rbb 00/11/21 16:40:21 Modified: src/main http_protocol.c src/include http_core.h Log: Next pass at the content-length filter. Not perfect quite yet, but getting closer Submitted by: Greg Stein Revision Changes Path 1.252 +9 -4 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.251 retrieving revision 1.252 diff -u -r1.251 -r1.252 --- http_protocol.c 2000/11/21 20:17:20 1.251 +++ http_protocol.c 2000/11/22 00:40:17 1.252 @@ -2240,6 +2240,7 @@ struct content_length_ctx { ap_bucket_brigade *saved; int compute_len; + apr_size_t curr_len; }; /* This filter computes the content length, but it also computes the number @@ -2276,10 +2277,11 @@ else { length = e->length; } + ctx->curr_len += length; r->bytes_sent += length; } - if (r->bytes_sent < AP_MIN_BYTES_TO_WRITE) { + if ((ctx->curr_len < AP_MIN_BYTES_TO_WRITE) && !send_it) { ap_save_brigade(f, &ctx->saved, &b); return APR_SUCCESS; } @@ -2295,9 +2297,9 @@ */ if ((r->proto_num == HTTP_VERSION(1,1) && !ap_find_last_token(f->r->pool, - apr_table_get(r->headers_out, - "Transfer-Encoding"), - "chunked")) + apr_table_get(r->headers_out, + "Transfer-Encoding"), + "chunked")) || (f->r->connection->keepalive) || (AP_BUCKET_IS_EOS(AP_BRIGADE_LAST(b)))) { ctx->compute_len = 1; @@ -2318,9 +2320,12 @@ } if (ctx->saved) { AP_BRIGADE_CONCAT(ctx->saved, b); + ap_brigade_destroy(b); b = ctx->saved; + ctx->saved = NULL; } + ctx->curr_len = 0; return ap_pass_brigade(f->next, b); } 1.33 +1 -1 apache-2.0/src/include/http_core.h Index: http_core.h =================================================================== RCS file: /home/cvs/apache-2.0/src/include/http_core.h,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- http_core.h 2000/11/21 20:17:18 1.32 +++ http_core.h 2000/11/22 00:40:20 1.33 @@ -121,7 +121,7 @@ #define SATISFY_ANY 1 #define SATISFY_NOSPEC 2 -/* Make sure we don't write less than 4096 bytes at any one time. +/* Make sure we don't write less than 9000 bytes at any one time. */ #define AP_MIN_BYTES_TO_WRITE 9000