From: Greg Ames Date: Mon, 20 Mar 2006 15:51:16 +0000 (+0000) Subject: backport 327008 PR 18757. keep the C-L header for a HEAD with no X-Git-Tag: 2.0.56~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b297fcc4f072a1588dd26a88cb78ebca94d0a2e;p=thirdparty%2Fapache%2Fhttpd.git backport 327008 PR 18757. keep the C-L header for a HEAD with no response body. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@387226 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 84a29e7c9d0..7a1cc3b0fd3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.0.56 + *) keep the Content-Length header for a HEAD with no response body. + PR 18757 [Greg Ames] + *) SECURITY: CVE-2005-3357 (cve.mitre.org) mod_ssl: Fix a possible crash during access control checks if a non-SSL request is processed for an SSL vhost (such as the diff --git a/STATUS b/STATUS index af00c611274..8ccd5a3eecf 100644 --- a/STATUS +++ b/STATUS @@ -117,13 +117,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: http://svn.apache.org/viewcvs?view=rev&rev=154319 +1: stoddard, striker, wrowe (as corrected in subsequent patches) - *) backport 327008 PR 18757. keep the proxied Content-Length - header for a HEAD request. recently received a private email - saying it also fixes a PHP HEAD request in 2.0.x. - http://svn.apache.org/viewcvs?rev=327008&view=rev - +1: gregames, trawick, niq - - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ please place SVN revisions from trunk here, so it is easy to identify exactly what the proposed changes are! Add all new diff --git a/server/protocol.c b/server/protocol.c index 80cea4834c8..518590244e5 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -1240,7 +1240,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); }