From 74b2a2d9641b6b1d3572d4706fa0cae34ea9e130 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 26 Nov 2012 10:15:32 -0800 Subject: [PATCH] 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 --- src/rgw/rgw_rest.cc | 9 --------- src/rgw/rgw_rest.h | 2 -- 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 c2ea5253a549f..99eb090e9dc92 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 4ac5a5383e3f0..35c34a6cdba35 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 4ae3258f67d68..f200db847fa97 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) -- 2.39.5