]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add support for object prefixes in Swift's FormPost.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 19 Sep 2016 10:28:08 +0000 (12:28 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 24 Apr 2017 15:32:14 +0000 (17:32 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_rest_swift.cc
src/rgw/rgw_rest_swift.h

index 3cc5994ed699e1421cf28ba8740813e2e2239966..f0069700463bc57d7674b97e6a3e047b6044e07c 100644 (file)
@@ -1714,6 +1714,16 @@ bool RGWInfo_ObjStore_SWIFT::is_expired(const std::string& expires, CephContext*
 }
 
 
+void RGWFormPost::init(RGWRados* const store,
+                       req_state* const s,
+                       RGWHandler* const dialect_handler)
+{
+  prefix = std::move(s->object.name);
+  s->object = rgw_obj_key();
+
+  return RGWPostObj_ObjStore::init(store, s, dialect_handler);
+}
+
 int RGWFormPost::get_params()
 {
   /* The parentt class extracts boundary info from the Content-Type. */
@@ -1792,13 +1802,13 @@ std::string RGWFormPost::get_current_filename() const
     const auto iter = field.params.find("filename");
 
     if (std::end(field.params) != iter) {
-      return s->object.name + iter->second;
+      return prefix + iter->second;
     }
   } catch (std::out_of_range&) {
     /* NOP */;
   }
 
-  return s->object.name;
+  return prefix;
 }
 
 bool RGWFormPost::is_next_file_to_upload()
index 26524af303222c38d7e4201c963f1d4ae3afa0e7..6572034a87c77872c0317ee50f004d66bcb30362 100644 (file)
@@ -243,13 +243,17 @@ class RGWFormPost : public RGWPostObj_ObjStore {
   bool is_next_file_to_upload() override;
 
   boost::optional<post_form_part> current_data_part;
-
+  std::string prefix;
   bool stream_done = false;
 
 public:
   RGWFormPost() = default;
   ~RGWFormPost() = default;
 
+  void init(RGWRados* store,
+            req_state* s,
+            RGWHandler* dialect_handler) override;
+
   int get_params() override;
   int get_data(ceph::bufferlist& bl) override;
   void send_response() override;