From: Jeff Trawick Date: Fri, 10 Nov 2000 18:04:44 +0000 (+0000) Subject: Don't use ap_bucket_read() to find the length unless e->length is X-Git-Tag: APACHE_2_0_ALPHA_8~111 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a13ab6f1ee988e2c1abae6d90c6c352ac48e0b1;p=apache Don't use ap_bucket_read() to find the length unless e->length is -1. Otherwise, we'll never use apr_sendfile(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86911 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 3c07e94936..7df5924fb3 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -2288,9 +2288,14 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, if (AP_BUCKET_IS_EOS(e) || AP_BUCKET_IS_FLUSH(e)) { send_it = 1; } - rv = ap_bucket_read(e, &ignored, &length, AP_BLOCK_READ); - if (rv != APR_SUCCESS) { - return rv; + if (e->length == -1) { /* if length unknown */ + rv = ap_bucket_read(e, &ignored, &length, AP_BLOCK_READ); + if (rv != APR_SUCCESS) { + return rv; + } + } + else { + length = e->length; } r->bytes_sent += length; }