]> granicus.if.org Git - apache/commitdiff
If the content-length is zero, then we don't output the Content-Length
authorRyan Bloom <rbb@apache.org>
Tue, 14 Nov 2000 04:52:33 +0000 (04:52 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 14 Nov 2000 04:52:33 +0000 (04:52 +0000)
header file.  The only time that the C-L should be zero is if there is
no body.  Zero is a valid content-length, but the only time that we ever
really send it is on a HEAD request right now, and that is incorrect.
The HEAD response should have the actual content's length.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86953 13f79535-47bb-0310-9956-ffa450edef68

modules/http/http_protocol.c

index d054b638d7636313d22066e0f4ef09a150fbdda4..e7a90b2341c1acfe807210c23e1bfa60f173118f 100644 (file)
@@ -2490,6 +2490,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f, ap_bu
         apr_table_addn(r->headers_out, "Expires", date);
     }
 
+    if (!strcmp(apr_table_get(r->headers_out, "Content-Length"), "0")) {
+        apr_table_unset(r->headers_out, "Content-Length");
+    }
+
     apr_table_do((int (*) (void *, const char *, const char *)) compute_header_len,
                  (void *) &len, r->headers_out, NULL);