]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
backport 327008 PR 18757. keep the C-L header for a HEAD with no
authorGreg Ames <gregames@apache.org>
Mon, 20 Mar 2006 15:51:16 +0000 (15:51 +0000)
committerGreg Ames <gregames@apache.org>
Mon, 20 Mar 2006 15:51:16 +0000 (15:51 +0000)
response body.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@387226 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
server/protocol.c

diff --git a/CHANGES b/CHANGES
index 84a29e7c9d09aaafd21b603c53f0771f41989a78..7a1cc3b0fd39d098807e6424665ff3d22de8fe2b 100644 (file)
--- 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 af00c611274c3deead85c3e7cd5045aba256ff6a..8ccd5a3eecf47f90c115f8698c8d28d30a5e1ed7 100644 (file)
--- 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
index 80cea4834c8282674c44e59a777d0e36c83de79f..518590244e5515f372d56b8ad94cf6f4245a1163 100644 (file)
@@ -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);
     }