]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix the Content-Length in response header is inconsistent with response body... 52341/head
authormengxiangrui <mengxr@chinatelecom.cn>
Sat, 21 Aug 2021 07:20:00 +0000 (15:20 +0800)
committerMark Kogan <mkogan@ibm.com>
Wed, 26 Jul 2023 11:41:09 +0000 (11:41 +0000)
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 <huaicun@chinatelecom.cn>
Co-authored-by: yupeng chen <chenyupeng@chinatelecom.cn>
Signed-off-by: xiangrui meng <mengxr@chinatelecom.cn>
src/rgw/rgw_rest.cc

index 5bba3fce4d1cef819275634a695bb91812077125..4c2b9a55b3ee06f1dc562082a1d6f6d70222ab2d 100644 (file)
@@ -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) {