From: mengxiangrui Date: Sat, 21 Aug 2021 07:20:00 +0000 (+0800) Subject: rgw: fix the Content-Length in response header is inconsistent with response body... X-Git-Tag: v19.0.0~777^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F52341%2Fhead;p=ceph.git rgw: fix the Content-Length in response header is inconsistent with response body size when rgw returns default html error page in static website The default html error page as response body should be built completely include three ending html symbols(/ul, /body and /html) before rgw computes Content-Length in response header. The Content-Length in response header will be consistent with response body size. Client can get complete page. Fixes: https://tracker.ceph.com/issues/52363 (cherry picked from commit cbeaef9fbe96c930fc10b793773e7ecd137fde81) Co-authored-by: aicun hu Co-authored-by: yupeng chen Signed-off-by: xiangrui meng --- diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index 5bba3fce4d1c..4c2b9a55b3ee 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -606,6 +606,7 @@ void end_header(req_state* s, RGWOp* op, const char *content_type, if (!force_no_error && s->is_err()) { dump_start(s); dump(s); + s->formatter->output_footer(); dump_content_length(s, s->formatter ? s->formatter->get_len() : 0); } else { if (proposed_content_length == CHUNKED_TRANSFER_ENCODING) {