From: ashitakasam <694240887@qq.com> Date: Mon, 20 Aug 2018 08:49:52 +0000 (+0800) Subject: rgw: the error code returned by rgw is different from amz s3 when X-Git-Tag: v12.2.13~220^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f950a7aed2e8f783d46a3b1944d933281c3ef422;p=ceph.git rgw: the error code returned by rgw is different from amz s3 when getting cors from the bucket without cors configuration Fixes: http://tracker.ceph.com/issues/26964 Signed-off-by: ashitakasam <694240887@qq.com> (cherry picked from commit 009a67fe4d09c4904bb9711f9bd4c60f353199ec) Conflicts: src/rgw/rgw_common.cc - luminous has no ERR_NO_ROLE_FOUND src/rgw/rgw_op.cc - mimic uses dout(2) instead of ldpp_dout(this, 2) --- diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index 0a31d5d34141..6be06af322b2 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -92,6 +92,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_NO_SUCH_LC, {404, "NoSuchLifecycleConfiguration"}}, { ERR_NO_SUCH_BUCKET_POLICY, {404, "NoSuchBucketPolicy"}}, { ERR_NO_SUCH_USER, {404, "NoSuchUser"}}, + { ERR_NO_CORS_FOUND, {404, "NoSuchCORSConfiguration"}}, { ERR_NO_SUCH_SUBUSER, {404, "NoSuchSubUser"}}, { ERR_NO_SUCH_CORS_CONFIGURATION, {404, "NoSuchCORSConfiguration"}}, { ERR_METHOD_NOT_ALLOWED, {405, "MethodNotAllowed" }}, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 72f42c53f1b2..226d0dc742d8 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -220,6 +220,7 @@ using ceph::crypto::MD5; #define ERR_ZONEGROUP_DEFAULT_PLACEMENT_MISCONFIGURATION 2213 #define ERR_INVALID_ENCRYPTION_ALGORITHM 2214 #define ERR_INVALID_CORS_RULES_ERROR 2215 +#define ERR_NO_CORS_FOUND 2216 #define ERR_BUSY_RESHARDING 2300 diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index f9e67c0d75d3..01f78d390bac 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -5046,7 +5046,7 @@ void RGWGetCORS::execute() if (!cors_exist) { dout(2) << "No CORS configuration set yet for this bucket" << dendl; - op_ret = -ENOENT; + op_ret = -ERR_NO_CORS_FOUND; return; } }