]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: streaming put also stores content_type and other fields
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 23 Mar 2018 00:33:29 +0000 (17:33 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Thu, 12 Apr 2018 22:38:40 +0000 (15:38 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rest_client.cc

index a12fbbf80081fb6fc75135fedc3b19601d87ae4b..ea3dedf196b73933d2932f13401d2b29655e61a3 100644 (file)
@@ -510,6 +510,11 @@ int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, map<string, bufferlist>
   return send_ready(key, new_attrs, policy, send);
 }
 
+static std::set<string> keep_headers = { "content-type",
+                                         "content-encoding",
+                                         "content-disposition",
+                                         "content-language" };
+
 int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, const map<string, string>& http_attrs,
                                       RGWAccessControlPolicy& policy, bool send)
 {
@@ -522,6 +527,10 @@ int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, const map<string, strin
     if (name.compare(0, sizeof(RGW_AMZ_PREFIX) - 1, RGW_AMZ_PREFIX) == 0) {
       new_env.set(name, val);
       new_info.x_meta_map[name] = val;
+    } else if (keep_headers.find(name) != keep_headers.end()) {
+      new_env.set(attr.first, val); /* Ugh, using the uppercase representation,
+                                       as the signing function calls info.env.get("CONTENT_TYPE").
+                                       This needs to be cleaned up! */
     }
   }