From: Joe Orton Date: Wed, 7 Dec 2005 16:58:01 +0000 (+0000) Subject: Merge r327008 from trunk: X-Git-Tag: 2.2.1~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11400378eea3c379075ba619555d13932e0e482e;p=thirdparty%2Fapache%2Fhttpd.git Merge r327008 from trunk: keep the proxied Content-Length header for a HEAD response. PR: 18757 Submitted by: gregames Reviewed by: jorton, jerenkrantz, niq, wrowe git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@354800 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 3d6d60a783c..b8623e7d0dc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.0 + *) Preserve the Content-Length header for a proxied HEAD response. + PR 18757. [Greg Ames] + *) mod_negotiation: Minor performance tweak by reusing already calculated strlen. [Ruediger Pluem, Christophe Jaillet ] diff --git a/STATUS b/STATUS index 9a14f7780c6..32dfdc537c1 100644 --- a/STATUS +++ b/STATUS @@ -96,15 +96,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK: Trunk version of patch works +1: rpluem, jerenkrantz - * core: Stop stripping C-L from HEAD responses which prevents use - of Windows Update through mod_proxy amongst other things. - http://svn.apache.org/viewcvs.cgi?rev=327008&view=rev - PR: 18757 - +1: jorton, jerenkrantz - +1: niq - this looks fine, but the comment about filters - misses the fact that mod_filter's protocol handling - gives us the 'long term' if we just use it. - * mod_ssl/ab: Fix compiler warnings with OpenSSL 0.9.8a. http://svn.apache.org/viewcvs.cgi?rev=349415&view=rev +1: jorton, jerenkrantz diff --git a/server/protocol.c b/server/protocol.c index 7bbc8897494..d5b1d6cc2c7 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -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); }