From: Radoslaw Zarzynski Date: Mon, 19 Sep 2016 10:28:08 +0000 (+0200) Subject: rgw: add support for object prefixes in Swift's FormPost. X-Git-Tag: v12.0.3~99^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a44a2c2430423e6ad15281e0dd307e4fc760bfe7;p=ceph.git rgw: add support for object prefixes in Swift's FormPost. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 3cc5994ed699..f0069700463b 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -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() diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h index 26524af30322..6572034a87c7 100644 --- a/src/rgw/rgw_rest_swift.h +++ b/src/rgw/rgw_rest_swift.h @@ -243,13 +243,17 @@ class RGWFormPost : public RGWPostObj_ObjStore { bool is_next_file_to_upload() override; boost::optional 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;