From: Ryan Bloom Date: Wed, 7 Mar 2001 17:01:28 +0000 (+0000) Subject: Fix content-length computation. We ONLY compute a content-length if X-Git-Tag: 2.0.14~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48c376abcf8013771fbca8fd982ff4e234ed2af7;p=apache Fix content-length computation. We ONLY compute a content-length if We are not in a 1.1 request and we cannot chunk, and this is a keepalive or we already have all the data. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88464 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 1026446531..dc3aff6405 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 2.0.14-dev + *) Fix content-length computation. We ONLY compute a content-length if + We are not in a 1.1 request and we cannot chunk, and this is a keepalive + or we already have all the data. [Ryan Bloom] + *) Report unbounded containers in the config file. Previously, a typo in the directive could result in the rest of the config file being silently ignored, with undesired defaults used. diff --git a/server/protocol.c b/server/protocol.c index 0bfd0ded90..b6838b4424 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -1176,20 +1176,20 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f, } /* We will compute a content length if: - * We already have all the data + * The protocol is < 1.1 + * and We can not chunk + * and this is a keepalive request. + * or We already have all the data * This is a bit confusing, because we will always buffer up * to AP_MIN_BYTES_TO_WRITE, so if we get all the data while * we are buffering that much data, we set the c-l. - * or We are in a 1.1 request and we can't chunk - * or This is a keepalive connection - * We may want to change this later to just close the connection */ - if ((r->proto_num == HTTP_VERSION(1,1) - && !ap_find_last_token(f->r->pool, + if ((r->proto_num < HTTP_VERSION(1,1) + && (!ap_find_last_token(f->r->pool, apr_table_get(r->headers_out, "Transfer-Encoding"), - "chunked")) - || (f->r->connection->keepalive) + "chunked") + && (f->r->connection->keepalive))) || (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(b)))) { ctx->compute_len = 1; }