From 37964eaaae7ec7aff5d6a0df73a4ca4663e0c03c Mon Sep 17 00:00:00 2001 From: Hiroaki Nakamura Date: Sat, 17 Jun 2023 23:58:06 +0900 Subject: [PATCH 1/2] Do not add content-length for status 204 cache --- 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 7753db9508e..086957e77ed 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6748,7 +6748,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 (!(s->source == SOURCE_CACHE && header->status_get() == HTTP_STATUS_NO_CONTENT)) { + header->set_content_length(cl); + } s->hdr_info.trust_response_cl = true; } } else { From 2faa3f9ab72b0b6dbfa02ebb831b98cb8340d033 Mon Sep 17 00:00:00 2001 From: Hiroaki Nakamura Date: Wed, 21 Jun 2023 08:15:00 +0900 Subject: [PATCH 2/2] Do not add content-length when proxying status 204 response too --- proxy/http/HttpTransact.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index 086957e77ed..f2e6dfae5bb 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6748,7 +6748,7 @@ 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 { - if (!(s->source == SOURCE_CACHE && header->status_get() == HTTP_STATUS_NO_CONTENT)) { + if (header->status_get() != HTTP_STATUS_NO_CONTENT) { header->set_content_length(cl); } s->hdr_info.trust_response_cl = true;