]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: S3 Delete Bucket Policy should return 204 on success 61432/head
authorSimon Jürgensmeyer <simon.juergensmeyer@hetzner-cloud.de>
Wed, 15 Jan 2025 08:08:38 +0000 (09:08 +0100)
committerCasey Bodley <cbodley@redhat.com>
Fri, 17 Jan 2025 16:53:53 +0000 (11:53 -0500)
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 <simon.juergensmeyer@hetzner-cloud.de>
(cherry picked from commit 466930b473292978b30a60e410dc755140ecb843)

src/rgw/rgw_op.cc

index cb9b75359cf8f908fe6c1dd5f7f4ee52521fc449..6978fe75fb544daba6dd9f36dfbebb561551e08e 100644 (file)
@@ -8310,6 +8310,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);
   }
@@ -8968,4 +8972,3 @@ void rgw_slo_entry::decode_json(JSONObj *obj)
   JSONDecoder::decode_json("etag", etag, obj);
   JSONDecoder::decode_json("size_bytes", size_bytes, obj);
 };
-