From b8aafbc6f9f80f029606a577d73f8685a80225b8 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Tue, 23 Jun 2015 11:54:09 +0200 Subject: [PATCH] rgw: enforce Content-Type in Swift responses. Swift sends Content-Type HTTP header even if the response doesn't contain body. We have this behaviour implemented until applying some changes in end_header() function. Unfortunately, lack of Content-Type causes early exits in many Tempest's tests for Swift API verification. Fixes: #12157 Signed-off-by: Radoslaw Zarzynski (cherry picked from commit 106aeba206736d4080326f9bc191876bed63370b) --- src/rgw/rgw_rest.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index a9fa43428e4f8..7f9472de8cc67 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -513,6 +513,10 @@ void end_header(struct req_state *s, RGWOp *op, const char *content_type, const dump_access_control(s, op); } + if (s->prot_flags & RGW_REST_SWIFT) { + force_content_type = true; + } + /* do not send content type if content length is zero and the content type was not set by the user */ if (force_content_type || (!content_type && s->formatter->get_len() != 0) || s->err.is_err()){ -- 2.39.5