New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rgw : add the check for bucket handler if http args exist object_exclusive sub_resource #38741
Conversation
i check all over the sub_resource of bucket and object, "append", "torrent", "uploadId","uploads", "partNumber", "versionId" are object_exclusive, and "cors","notification","location","logging","lifecycle","delete","versions","versioning","website","requestPayment","position","policyStatus","publicAccessBlock" are bucket_exclusive , "acl", "tagging" are shared. So the nonstandard request wont pass. |
src/rgw/rgw_rest_s3.cc
Outdated
@@ -4878,7 +4878,7 @@ 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())) { | |||
} else if (rgw::sal::RGWObject::empty(s->object.get()) && !s->info.args.exist_obj_excl_sub_resource()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the right idea, I think, but I don't think we want to dispatch into the object handler if we have no object. How about re-arranging it so it looks like this:
if (!object.empty()) {
handler = object_hander;
} else if (exist_obj_excl_sub_resource()) {
return NULL;
} else {
handler = bucket_handler;
}
src/rgw/rgw_common.h
Outdated
bool exist_obj_excl_sub_resource() const { | ||
char* obj_sub_resource[] = {"append", "torrent", "uploadId", | ||
"uploads", "partNumber", "versionId"}; | ||
for (int i = 0; i != 6; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6 should be obj_sub_resource.size()
acfd483
to
b7b0cd6
Compare
@dang Thx, it would be unsafe and Inefficient to dispatch into the object handler when object is empty, i hava corrected the code. |
@ofriedma thank you for advance in code elegance. this part has been modified. |
@BryceCao |
b7b0cd6
to
5748a05
Compare
@ofriedma comment has been added. |
this appears to be failing test_list_multipart_upload:
|
Oh, I made a mistake here. |
…usive sub_resource Fixes: https://tracker.ceph.com/issues/48727 Signed-off-by: caolei <halei15848934852@163.com>
5748a05
to
52a59ad
Compare
Fixes: https://tracker.ceph.com/issues/48727
Signed-off-by: caolei halei15848934852@163.com
Checklist
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox