Commit 0cff629d authored by Ryan Bloom's avatar Ryan Bloom
Browse files

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
parent 1cb932f1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
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 </container> directive could result in the rest of the config
     file being silently ignored, with undesired defaults used.
+8 −8
Original line number Diff line number Diff line
@@ -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;
    }