This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.2.x by this push:
     new 7226cbaa94 Do not add content-length for status 204 cache (#9877)
7226cbaa94 is described below

commit 7226cbaa947792b83801c6e3575b09cd4acb5429
Author: Hiroaki Nakamura <hnaka...@gmail.com>
AuthorDate: Thu Jun 22 06:33:28 2023 +0900

    Do not add content-length for status 204 cache (#9877)
    
    * Do not add content-length for status 204 cache
    
    * Do not add content-length when proxying status 204 response too
    
    (cherry picked from commit 327a003045f4019a9ebdc4ed7400e5b824297cf2)
---
 proxy/http/HttpTransact.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 39e78c9c2e..69e8d3d6c6 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -6807,7 +6807,9 @@ HttpTransact::handle_content_length_header(State *s, 
HTTPHdr *header, HTTPHdr *b
         change_response_header_because_of_range_request(s, header);
         s->hdr_info.trust_response_cl = true;
       } else {
-        header->set_content_length(cl);
+        if (header->status_get() != HTTP_STATUS_NO_CONTENT) {
+          header->set_content_length(cl);
+        }
         s->hdr_info.trust_response_cl = true;
       }
     } else {

Reply via email to