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: testing/wip-vshankar-testing-20250110.122509-reef-debug~11^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=80fafc50f2145419c721649207b2581244c7b396;p=ceph-ci.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 (cherry picked from commit e0bb8313fdfdc86352e8e2343599c02e574aeae3) --- diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index fa62e19a511..103651833b4 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -607,6 +607,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->get_len()); } else { if (proposed_content_length == CHUNKED_TRANSFER_ENCODING) {