diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2012-11-26 10:15:32 -0800 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2012-11-26 12:29:40 -0800 |
commit | 74b2a2d9641b6b1d3572d4706fa0cae34ea9e130 (patch) | |
tree | 169cb7890dc640955dcca57a0307fecc76ea3122 | |
parent | 1f8c32347b6eba3ab2ab61c12f3b02f3431e10fc (diff) | |
download | ceph-74b2a2d9641b6b1d3572d4706fa0cae34ea9e130.tar.gz |
rgw: POST requests not default to init multipart upload
Fixes: #3516
We don't default to init multipart upload request when
getting S3 POST. This way when the request is not really
init multipart upload we'd end up sending a 405 response
instead of 500. Also, it's cleaner this way.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_rest.cc | 9 | ||||
-rw-r--r-- | src/rgw/rgw_rest.h | 2 | ||||
-rw-r--r-- | src/rgw/rgw_rest_s3.cc | 7 |
3 files changed, 5 insertions, 13 deletions
diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index c2ea5253a54..99eb090e9dc 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -582,15 +582,6 @@ int RGWPutACLs_ObjStore::get_params() return ret; } -int RGWInitMultipart_ObjStore::get_params() -{ - if (!s->args.exists("uploads")) { - ret = -ENOTSUP; - } - - return ret; -} - static int read_all_chunked_input(req_state *s, char **pdata, int *plen) { #define READ_CHUNK 4096 diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index 4ac5a5383e3..35c34a6cdba 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -152,8 +152,6 @@ class RGWInitMultipart_ObjStore : public RGWInitMultipart { public: RGWInitMultipart_ObjStore() {} ~RGWInitMultipart_ObjStore() {} - - virtual int get_params(); }; class RGWCompleteMultipart_ObjStore : public RGWCompleteMultipart { diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 4ae3258f67d..f200db847fa 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -1237,7 +1237,7 @@ int RGWInitMultipart_ObjStore_S3::get_params() policy = s3policy; - return RGWInitMultipart_ObjStore::get_params(); + return 0; } void RGWInitMultipart_ObjStore_S3::send_response() @@ -1578,8 +1578,11 @@ RGWOp *RGWHandler_ObjStore_Obj_S3::op_post() { if (s->args.exists("uploadId")) return new RGWCompleteMultipart_ObjStore_S3; - else + + if (s->args.exists("uploads")) return new RGWInitMultipart_ObjStore_S3; + + return NULL; } int RGWHandler_ObjStore_S3::init_from_header(struct req_state *s, int default_formatter, bool configurable_format) |