]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r327008 from trunk:
authorJoe Orton <jorton@apache.org>
Wed, 7 Dec 2005 16:58:01 +0000 (16:58 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 7 Dec 2005 16:58:01 +0000 (16:58 +0000)
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

CHANGES
STATUS
server/protocol.c

diff --git a/CHANGES b/CHANGES
index 3d6d60a783cde529f6ab8106fb63a69081d2e11b..b8623e7d0dc15933bb80e49bc22891d922708181 100644 (file)
--- 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 <christophe.jaillet wanadoo.fr>]
diff --git a/STATUS b/STATUS
index 9a14f7780c61f2e92ac89856b354da94307c0d36..32dfdc537c117ddc45d37a3df160b94dfff14040 100644 (file)
--- 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
index 7bbc889749414928ff764887b3ec990063afabd4..d5b1d6cc2c7e2cbaa22b1a45d801c68e4529d446 100644 (file)
@@ -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);
     }