From: Ryan Bloom Date: Tue, 14 Nov 2000 04:52:33 +0000 (+0000) Subject: If the content-length is zero, then we don't output the Content-Length X-Git-Tag: APACHE_2_0_ALPHA_8~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66b3a62de894f6edb484fd67927d72bfb3f47b30;p=apache If the content-length is zero, then we don't output the Content-Length 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 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index d054b638d7..e7a90b2341 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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);