From e53751d0e52f6fb611d9bd81fe2115cd7ce533b3 Mon Sep 17 00:00:00 2001 From: Wido den Hollander Date: Mon, 21 Mar 2016 16:50:49 +0100 Subject: [PATCH] rgw: Do not send a Content-Type on a '304 Not Modified' response When we say the Content has not changed we should not respond with a content type which defaults to binary/octet stream. Fixes: #15119 Signed-off-by: Wido den Hollander (cherry picked from commit 471fa29e643fcfd5e1383fb987f99b5b21038ed7) --- src/rgw/rgw_rest_s3.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 0cc7793ac9ad..72e1fe135dde 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -167,10 +167,14 @@ done: s->cio->print("%s: %s\r\n", riter->first.c_str(), riter->second.c_str()); } - if (!content_type) - content_type = "binary/octet-stream"; + if (ret == ERR_NOT_MODIFIED) { + end_header(s, this); + } else { + if (!content_type) + content_type = "binary/octet-stream"; - end_header(s, this, content_type); + end_header(s, this, content_type); + } if (metadata_bl.length()) { s->cio->write(metadata_bl.c_str(), metadata_bl.length()); -- 2.47.3