]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add COPY method to be handled by CORS
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 29 Aug 2013 04:24:36 +0000 (21:24 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 11 Sep 2013 16:45:14 +0000 (09:45 -0700)
Was missing this http method.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_cors.h
src/rgw/rgw_cors_s3.cc

index 415f3f0b869b74daf57db714acb9726669946e06..1e0ec3bc7ece9d3fe95307ade37ae1d98041e7d6 100644 (file)
 #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)
 
index c1448f26b23e041db385535b1d7d6173ec9ff642..01150a9e65b6053def4bee4424fe29fed3f540ce 100644 (file)
@@ -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;
       }