From: Nick Kew Date: Wed, 1 Sep 2004 12:24:48 +0000 (+0000) Subject: Fix for Bug 18757 (sending bogus content-length of zero in no-body requests) X-Git-Tag: 2.1.1~381 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf9053ecbd964fb016d39d111ce5c23c1ec47644;p=thirdparty%2Fapache%2Fhttpd.git Fix for Bug 18757 (sending bogus content-length of zero in no-body requests) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104923 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/protocol.c b/server/protocol.c index c051822c6c8..cf62767e7fa 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -1244,8 +1244,11 @@ 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. + * + * Also check against cases of zero bytes sent, to avoid a bogus + * C-L on HEAD requests, or no-body GETs like 204s. */ - if (ctx->data_sent == 0 && eos) { + if (ctx->data_sent == 0 && eos && r->bytes_sent > 0 ) { ap_set_content_length(r, r->bytes_sent); }