Commit 5c6ccb0e authored by Greg Ames's avatar Greg Ames
Browse files

keep the proxied Content-Length header for a HEAD response. PR 18757


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@327008 13f79535-47bb-0310-9956-ffa450edef68
parent 79e4ba22
Loading
Loading
Loading
Loading
+3 −0
Changes for CHANGES: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@
Changes with Apache 2.3.0
  [Remove entries to the current 2.0 and 2.2 section below, when backported]
  *) Preserve the Content-Length header for a proxied HEAD request.
     PR 18757 [Greg Ames]
  
  *) mod_cache: Create new filters CACHE_OUT_SUBREQ / CACHE_SAVE_SUBREQ which
     only differ by the type from CACHE_OUT / CACHE_SAVE to ensure that
     subrequests to non local resources work again. [Ruediger Pluem]
+13 −1
Changes for server/protocol.c: 13 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -1302,7 +1302,19 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(
     * We can only set a C-L in the response header if we haven't already
     * sent any buckets on to the next output filter for this request.
     */
    if (ctx->data_sent == 0 && eos) {
    if (ctx->data_sent == 0 && eos &&
        /* don't whack the C-L if it has already been set for a HEAD
         * by something like proxy.  the brigade only has an EOS bucket
         * in this case, making r->bytes_sent zero.
         *
         * if r->bytes_sent > 0 we have a (temporary) body whose length may 
         * have been changed by a filter.  the C-L header might not have been 
         * updated so we do it here.  long term it would be cleaner to have 
         * such filters update or remove the C-L header, and just use it 
         * if present.
         */
        !(r->header_only && r->bytes_sent == 0 &&   
            apr_table_get(r->headers_out, "Content-Length"))) {
        ap_set_content_length(r, r->bytes_sent);
    }