]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix for Bug 18757 (sending bogus content-length of zero in no-body requests)
authorNick Kew <niq@apache.org>
Wed, 1 Sep 2004 12:24:48 +0000 (12:24 +0000)
committerNick Kew <niq@apache.org>
Wed, 1 Sep 2004 12:24:48 +0000 (12:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104923 13f79535-47bb-0310-9956-ffa450edef68

server/protocol.c

index c051822c6c88e3ffa4bf730cdc016ffe78cfb12e..cf62767e7fa5c8276d9db7334e98cd3456fee232 100644 (file)
@@ -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);
     }