]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: POST requests not default to init multipart upload
authorYehuda Sadeh <yehuda@inktank.com>
Mon, 26 Nov 2012 18:15:32 +0000 (10:15 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 26 Nov 2012 20:29:40 +0000 (12:29 -0800)
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>
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h
src/rgw/rgw_rest_s3.cc

index c2ea5253a549f16e1f9651f31bbd896ee8fccdd2..99eb090e9dc920021ab6ed4aff18faa6e9847262 100644 (file)
@@ -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
index 4ac5a5383e3f09b03c0a3a61c5ba807deadff2f7..35c34a6cdba351277fd7ad0f1f4e9f83e5f552b8 100644 (file)
@@ -152,8 +152,6 @@ class RGWInitMultipart_ObjStore : public RGWInitMultipart {
 public:
   RGWInitMultipart_ObjStore() {}
   ~RGWInitMultipart_ObjStore() {}
-
-  virtual int get_params();
 };
 
 class RGWCompleteMultipart_ObjStore : public RGWCompleteMultipart {
index 4ae3258f67d68acf45b71e3db3df5c74c56bdbdd..f200db847fa9783f6b645a457c27ddc24bc23ba7 100644 (file)
@@ -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)