]> granicus.if.org Git - apache/commitdiff
Don't use ap_bucket_read() to find the length unless e->length is
authorJeff Trawick <trawick@apache.org>
Fri, 10 Nov 2000 18:04:44 +0000 (18:04 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 10 Nov 2000 18:04:44 +0000 (18:04 +0000)
-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

modules/http/http_protocol.c

index 3c07e94936721d40ce8738cc4a27d0be86f9d612..7df5924fb3518e5e71d8a7a20e2600d98ce4b303 100644 (file)
@@ -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;
     }