]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: force content-type header for swift account responses without body
authorOrit Wasserman <owasserm@redhat.com>
Tue, 21 Apr 2015 10:31:19 +0000 (12:31 +0200)
committerNathan Cutler <ncutler@suse.com>
Mon, 5 Oct 2015 14:00:59 +0000 (16:00 +0200)
This regression was introduced in commit 4cfeca03ade21861ab70ca759f94eb244c16cb39

Fixes: #11438
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
(cherry picked from commit 009664e560ee37ef6dc170a0155d6c749e151b06)

src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_swift.cc

index cadd56463114385b4612918754585d12d4a5c52b..4142809f8525f43a6d1afefc0235cf1b2fac63b6 100644 (file)
@@ -427,7 +427,8 @@ void dump_start(struct req_state *s)
   }
 }
 
-void end_header(struct req_state *s, RGWOp *op, const char *content_type, const int64_t proposed_content_length)
+void end_header(struct req_state *s, RGWOp *op, const char *content_type, const int64_t proposed_content_length,
+               bool force_content_type)
 {
   string ctype;
 
@@ -437,7 +438,7 @@ void end_header(struct req_state *s, RGWOp *op, const char *content_type, const
 
   /* do not send content type if content length is zero
      and the content type was not set by the user */
-  if ((s->formatter->get_len()  != 0 && !content_type) || s->err.is_err()){
+  if (force_content_type || (!content_type &&  s->formatter->get_len()  != 0) || s->err.is_err()){
     switch (s->format) {
     case RGW_FORMAT_XML:
       ctype = "application/xml";
index 71845359869449034d5805369281836230035556..0624e4f77b605b86f9810b472235ab91f1dd853b 100644 (file)
@@ -362,7 +362,8 @@ extern void dump_errno(struct req_state *s, int ret);
 extern void end_header(struct req_state *s,
                        RGWOp *op = NULL,
                        const char *content_type = NULL,
-                       const int64_t proposed_content_length = NO_CONTENT_LENGTH);
+                       const int64_t proposed_content_length = NO_CONTENT_LENGTH,
+                      bool force_content_type = false);
 extern void dump_start(struct req_state *s);
 extern void list_all_buckets_start(struct req_state *s);
 extern void dump_owner(struct req_state *s, string& id, string& name, const char *section = NULL);
index 51071734582365b278533e69d78d865f50e1a5dd..8569c401723ea2650e343e9ba126ab3eab339984 100644 (file)
@@ -52,7 +52,7 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)
     set_req_state_err(s, ret);
   }
   dump_errno(s);
-  end_header(s, NULL);
+  end_header(s, NULL, NULL, true);
 
   if (!ret) {
     dump_start(s);
@@ -282,7 +282,8 @@ void RGWStatAccount_ObjStore_SWIFT::send_response()
   set_req_state_err(s, ret);
   dump_errno(s);
 
-  end_header(s, NULL, NULL, 0);
+  end_header(s, NULL, NULL, 0,  true);
+
   dump_start(s);
 }