policy.encode(aclbl);
emplace_attr(RGW_ATTR_ACL, std::move(aclbl));
- if (content_type.size()) {
- bufferlist ct_bl;
+ const std::string content_type = get_current_content_type();
+ if (! content_type.empty()) {
+ ceph::bufferlist ct_bl;
ct_bl.append(content_type.c_str(), content_type.size() + 1);
emplace_attr(RGW_ATTR_CONTENT_TYPE, std::move(ct_bl));
}
const char *supplied_md5_b64;
const char *supplied_etag;
string etag;
- string content_type;
RGWAccessControlPolicy policy;
map<string, bufferlist> attrs;
boost::optional<ceph::real_time> delete_at;
/* Must be called after get_data() or the result is undefined. */
virtual std::string get_current_filename() const = 0;
+ virtual std::string get_current_content_type() const = 0;
virtual bool is_next_file_to_upload() {
return false;
}
return s->object.name;
}
+std::string RGWPostObj_ObjStore_S3::get_current_content_type() const
+{
+ return content_type;
+}
+
int RGWPostObj_ObjStore_S3::get_params()
{
op_ret = RGWPostObj_ObjStore::get_params();
class RGWPostObj_ObjStore_S3 : public RGWPostObj_ObjStore {
parts_collection_t parts;
std::string filename;
+ std::string content_type;
RGWPolicyEnv env;
RGWPolicy post_policy;
map<string, string> crypt_http_responses;
void rebuild_key(string& key);
std::string get_current_filename() const override;
+ std::string get_current_content_type() const override;
+
public:
RGWPostObj_ObjStore_S3() {}
~RGWPostObj_ObjStore_S3() override {}
return prefix;
}
+std::string RGWFormPost::get_current_content_type() const
+{
+ try {
+ const auto& field = current_data_part->fields.at("Content-Type");
+ return field.val;
+ } catch (std::out_of_range&) {
+ /* NOP */;
+ }
+
+ return std::string();
+}
+
bool RGWFormPost::is_next_file_to_upload()
{
if (! stream_done) {
class RGWFormPost : public RGWPostObj_ObjStore {
std::string get_current_filename() const override;
+ std::string get_current_content_type() const override;
std::size_t get_max_file_size() /*const*/;
bool is_next_file_to_upload() override;
bool is_integral();