From 40c873546a50f6c1de026c52bc344f171b1a983c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Simon=20J=C3=BCrgensmeyer?= Date: Wed, 15 Jan 2025 09:08:38 +0100 Subject: [PATCH] rgw: S3 Delete Bucket Policy should return 204 on success MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently, RGW returns a 200 on a successful DELETE on a bucket policy but the S3 API expects a 204: https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketPolicy.html The sample response in the example above is a 204. This patch checks the op_ret in `RGWDeleteBucketPolicy::send_response()` and on a success we turn it to a 204 (or STATUS_NO_CONTENT). Fixes: https://tracker.ceph.com/issues/69539 Signed-off-by: Simon Jürgensmeyer (cherry picked from commit 466930b473292978b30a60e410dc755140ecb843) --- src/rgw/rgw_op.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 414e1196691..b73aa80b767 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -7989,6 +7989,10 @@ void RGWGetBucketPolicy::execute(optional_yield y) void RGWDeleteBucketPolicy::send_response() { + if (!op_ret) { + /* A successful Delete Bucket Policy should return a 204 on success */ + op_ret = STATUS_NO_CONTENT; + } if (op_ret) { set_req_state_err(s, op_ret); } @@ -8664,4 +8668,3 @@ void rgw_slo_entry::decode_json(JSONObj *obj) JSONDecoder::decode_json("etag", etag, obj); JSONDecoder::decode_json("size_bytes", size_bytes, obj); }; - -- 2.39.5