You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/12/07 17:58:05 UTC

svn commit: r354800 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS server/protocol.c

Author: jorton
Date: Wed Dec  7 08:58:01 2005
New Revision: 354800

URL: http://svn.apache.org/viewcvs?rev=354800&view=rev
Log:
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

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/server/protocol.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/CHANGES?rev=354800&r1=354799&r2=354800&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Wed Dec  7 08:58:01 2005
@@ -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>]

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/STATUS?rev=354800&r1=354799&r2=354800&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Wed Dec  7 08:58:01 2005
@@ -96,15 +96,6 @@
          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

Modified: httpd/httpd/branches/2.2.x/server/protocol.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.2.x/server/protocol.c?rev=354800&r1=354799&r2=354800&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/protocol.c (original)
+++ httpd/httpd/branches/2.2.x/server/protocol.c Wed Dec  7 08:58:01 2005
@@ -1302,7 +1302,19 @@
      * 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);
     }