From 49e975b9a96828df32ad88ee8ce68342884f7df5 Mon Sep 17 00:00:00 2001 From: Nick Janus Date: Wed, 22 Nov 2017 13:29:00 -0500 Subject: [PATCH] rgw: Fix S3 compatibility bug when CORS is not found Fixes: http://tracker.ceph.com/issues/37945 Signed-off-by: Nick Janus (cherry picked from commit baaf5d6a1d7232d904d9f8d39b52498fe8480453) --- src/rgw/rgw_common.cc | 1 + src/rgw/rgw_common.h | 1 + src/rgw/rgw_rest_s3.cc | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.cc b/src/rgw/rgw_common.cc index d35a97eaf79..dcade32363e 100644 --- a/src/rgw/rgw_common.cc +++ b/src/rgw/rgw_common.cc @@ -94,6 +94,7 @@ rgw_http_errors rgw_http_s3_errors({ { ERR_NO_CORS_FOUND, {404, "NoSuchCORSConfiguration"}}, { ERR_NO_SUCH_SUBUSER, {404, "NoSuchSubUser"}}, { ERR_NO_SUCH_ENTITY, {404, "NoSuchEntity"}}, + { ERR_NO_SUCH_CORS_CONFIGURATION, {404, "NoSuchCORSConfiguration"}}, { ERR_METHOD_NOT_ALLOWED, {405, "MethodNotAllowed" }}, { ETIMEDOUT, {408, "RequestTimeout" }}, { EEXIST, {409, "BucketAlreadyExists" }}, diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 6dc8ef5f565..d558b6bdc2e 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -207,6 +207,7 @@ using ceph::crypto::MD5; #define ERR_NO_SUCH_USER 2042 #define ERR_NO_SUCH_SUBUSER 2043 #define ERR_MFA_REQUIRED 2044 +#define ERR_NO_SUCH_CORS_CONFIGURATION 2045 #define ERR_USER_SUSPENDED 2100 #define ERR_INTERNAL_ERROR 2200 #define ERR_NOT_IMPLEMENTED 2201 diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index be1c3fe6c43..77fa96415b8 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -2413,7 +2413,7 @@ void RGWGetCORS_ObjStore_S3::send_response() { if (op_ret) { if (op_ret == -ENOENT) - set_req_state_err(s, ERR_NOT_FOUND); + set_req_state_err(s, ERR_NO_SUCH_CORS_CONFIGURATION); else set_req_state_err(s, op_ret); } -- 2.47.3