Skip to content

Commit

Permalink
rgw : add the check for bucket handler if http args exist object_excl…
Browse files Browse the repository at this point in the history
…usive sub_resource

Fixes: https://tracker.ceph.com/issues/48727
Signed-off-by: caolei <halei15848934852@163.com>
  • Loading branch information
BryceCao committed Jan 8, 2021
1 parent 1bfac61 commit acfd483
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/rgw/rgw_common.h
Expand Up @@ -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 {
char* obj_sub_resource[] = {"append", "torrent", "uploadId",
"uploads", "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;
}
Expand Down
8 changes: 5 additions & 3 deletions src/rgw/rgw_rest_s3.cc
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit acfd483

Please sign in to comment.