]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: S3 Put Bucket Policy should return 204 on success 35059/head
authorMatthew Oliver <moliver@suse.com>
Thu, 14 May 2020 01:31:56 +0000 (11:31 +1000)
committerMatthew Oliver <moliver@suse.com>
Thu, 14 May 2020 01:37:53 +0000 (11:37 +1000)
Currently RGW returns a 200 on a successful PUT on a bucket policy but
the S3 api extects a 204, which makes sense as it's a success without
any contect returned:

   https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTpolicy.html

The sample response in the example above is a 204.

This patch checks the op_ret in `RGWPutBucketPolicy::send_response()`
and on a success we turn it to a 204 (or STATUS_NO_CONTENT).

Fixes: https://tracker.ceph.com/issues/45467
Signed-off-by: Matthew Oliver <moliver@suse.com>
src/rgw/rgw_op.cc

index 9a3d7390c2796b01e9b0bd017270500a33aaabe4..515fe58aafbf9888d98f5940f4dcf28044f443ad 100644 (file)
@@ -7647,6 +7647,10 @@ void RGWDefaultResponseOp::send_response() {
 
 void RGWPutBucketPolicy::send_response()
 {
+  if (!op_ret) {
+    /* A successful Put Bucket Policy should return a 204 on success */
+    op_ret = STATUS_NO_CONTENT;
+  }
   if (op_ret) {
     set_req_state_err(s, op_ret);
   }