]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw : add the check for bucket handler if http args exist object_exclusive sub_resource 38741/head
authorcao.leilc <cao.leilc@inspur.com>
Sat, 30 Jan 2021 02:08:56 +0000 (10:08 +0800)
committercao.leilc <cao.leilc@inspur.com>
Sat, 30 Jan 2021 02:08:56 +0000 (10:08 +0800)
Fixes: https://tracker.ceph.com/issues/48727
Signed-off-by: caolei <halei15848934852@163.com>
src/rgw/rgw_common.cc
src/rgw/rgw_common.h
src/rgw/rgw_rest_s3.cc

index b657598dba6e3f4d0e8f40b9e101a37ef0b22320..3e110c48c081ce4bea567ef7feca38fe2139739d 100644 (file)
@@ -838,6 +838,7 @@ void RGWHTTPArgs::append(const string& name, const string& val)
     val_map[name] = val;
   }
 
+// when sub_resources exclusive by object are added, please remember to update obj_sub_resource in RGWHTTPArgs::exist_obj_excl_sub_resource().
   if ((name.compare("acl") == 0) ||
       (name.compare("cors") == 0) ||
       (name.compare("notification") == 0) ||
index dd62c3e254b641f3ab55886eff0327ea513d95ba..691aa84e2d8320d3a3436f45595d8280054fac39 100644 (file)
@@ -353,6 +353,15 @@ class RGWHTTPArgs {
   bool sub_resource_exists(const char *name) const {
     return (sub_resources.find(name) != std::end(sub_resources));
   }
+  bool exist_obj_excl_sub_resource() const {
+    const char* const obj_sub_resource[] = {"append", "torrent", "uploadId",
+                                            "partNumber", "versionId"};
+    for (int i = 0; i != std::size(obj_sub_resource); i++) {
+      if (sub_resource_exists(obj_sub_resource[i])) return true;
+    }
+    return false;
+  }
+
   std::map<std::string, std::string>& get_params() {
     return val_map;
   }
index 5c1a2d9412140d8c18419d7e7679c4c4b86a29b6..104190dde36417d7bc382199cbec0083bdcb9562 100644 (file)
@@ -4878,10 +4878,12 @@ RGWHandler_REST* RGWRESTMgr_S3::get_handler(rgw::sal::RGWRadosStore *store,
   } else {
     if (s->init_state.url_bucket.empty()) {
       handler = new RGWHandler_REST_Service_S3(auth_registry, enable_sts, enable_iam, enable_pubsub);
-    } else if (rgw::sal::RGWObject::empty(s->object.get())) {
-      handler = new RGWHandler_REST_Bucket_S3(auth_registry, enable_pubsub);
-    } else {
+    } else if (!rgw::sal::RGWObject::empty(s->object.get())) {
       handler = new RGWHandler_REST_Obj_S3(auth_registry);
+    } else if (s->info.args.exist_obj_excl_sub_resource()) {
+      return NULL;
+    } else {
+      handler = new RGWHandler_REST_Bucket_S3(auth_registry, enable_pubsub);
     }
   }