summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-08-28 21:24:36 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-09-04 16:11:21 -0700
commit6ae4049a09143b0d364c03c5185f9cdc0e449e2f (patch)
tree1112ad63afbf446fec810ebd9a6ca9d4f8d28fc7
parent8203b9b05853d9620cea448132af3c9ed72e05ee (diff)
downloadceph-6ae4049a09143b0d364c03c5185f9cdc0e449e2f.tar.gz
rgw: add COPY method to be handled by CORS
Was missing this http method. Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_cors.h12
-rw-r--r--src/rgw/rgw_cors_s3.cc4
2 files changed, 11 insertions, 5 deletions
diff --git a/src/rgw/rgw_cors.h b/src/rgw/rgw_cors.h
index 415f3f0b869..1e0ec3bc7ec 100644
--- a/src/rgw/rgw_cors.h
+++ b/src/rgw/rgw_cors.h
@@ -25,11 +25,13 @@
#define RGW_CORS_HEAD 0x4
#define RGW_CORS_POST 0x8
#define RGW_CORS_DELETE 0x10
-#define RGW_CORS_ALL (RGW_CORS_GET | \
- RGW_CORS_PUT | \
- RGW_CORS_HEAD | \
- RGW_CORS_POST | \
- RGW_CORS_DELETE)
+#define RGW_CORS_COPY 0x20
+#define RGW_CORS_ALL (RGW_CORS_GET | \
+ RGW_CORS_PUT | \
+ RGW_CORS_HEAD | \
+ RGW_CORS_POST | \
+ RGW_CORS_DELETE | \
+ RGW_CORS_COPY)
#define CORS_MAX_AGE_INVALID ((uint32_t)-1)
diff --git a/src/rgw/rgw_cors_s3.cc b/src/rgw/rgw_cors_s3.cc
index c1448f26b23..01150a9e65b 100644
--- a/src/rgw/rgw_cors_s3.cc
+++ b/src/rgw/rgw_cors_s3.cc
@@ -44,6 +44,8 @@ void RGWCORSRule_S3::to_xml(XMLFormatter& f) {
f.dump_string("AllowedMethod", "HEAD");
if (allowed_methods & RGW_CORS_POST)
f.dump_string("AllowedMethod", "POST");
+ if (allowed_methods & RGW_CORS_COPY)
+ f.dump_string("AllowedMethod", "COPY");
/*AllowedOrigins*/
for(set<string>::iterator it = allowed_origins.begin();
it != allowed_origins.end();
@@ -87,6 +89,8 @@ bool RGWCORSRule_S3::xml_end(const char *el) {
allowed_methods |= RGW_CORS_HEAD;
} else if (strcasecmp(s, "PUT") == 0) {
allowed_methods |= RGW_CORS_PUT;
+ } else if (strcasecmp(s, "COPY") == 0) {
+ allowed_methods |= RGW_CORS_COPY;
} else {
return false;
}