]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix X-Object-Meta-Static-Large-Object in SLO download 15045/head
authorlu.shasha <lu.shasha@eisoo.com>
Thu, 11 May 2017 07:23:29 +0000 (15:23 +0800)
committerlu.shasha <lu.shasha@eisoo.com>
Wed, 17 May 2017 02:41:15 +0000 (10:41 +0800)
when download SLO objects, the response header "X-Object-Meta-Static-Large-Object" doesn't decode. Expect value is "True", but there is four bytes gibberish before it.

Fixes: http://tracker.ceph.com/issues/19951
Signed-off-by: Shasha Lu <lu.shasha@eisoo.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rest_s3.cc
src/rgw/rgw_rest_swift.cc

index 844b1dad5b020fdd3aedea13a20b18579f9caaca..eb342c6ea00fadcc48aad133f77fc8f67aeb9d98 100644 (file)
@@ -3223,7 +3223,7 @@ void RGWPutObj::execute()
    * processing any input from user in order to prohibit overwriting. */
   if (slo_info) {
     bufferlist slo_userindicator_bl;
-    ::encode("True", slo_userindicator_bl);
+    slo_userindicator_bl.append("True", 4);
     emplace_attr(RGW_ATTR_SLO_UINDICATOR, std::move(slo_userindicator_bl));
   }
 
index b41441160f58f5a32134a2ada39f8755cabc5699..6e53ed74c4e0645f23df611bcc8be2694aa18197 100644 (file)
@@ -276,6 +276,9 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
         if (!content_type) {
           content_type = iter->second.c_str();
         }
+      } else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) {
+        // this attr has an extra length prefix from ::encode() in prior versions
+        dump_header(s, "X-Object-Meta-Static-Large-Object", "True");
       } else if (strncmp(name, RGW_ATTR_META_PREFIX,
                         sizeof(RGW_ATTR_META_PREFIX)-1) == 0) {
         /* User custom metadata. */
index f778d87c412ac447fd4f0b2bb1a8c7be39d4414e..60281088d634c4e3b20c9f104a4c5878f4fc2ac5 100644 (file)
@@ -1106,6 +1106,9 @@ static void dump_object_metadata(struct req_state * const s,
 
     if (aiter != std::end(rgw_to_http_attrs)) {
       response_attrs[aiter->second] = kv.second.c_str();
+    } else if (strcmp(name, RGW_ATTR_SLO_UINDICATOR) == 0) {
+      // this attr has an extra length prefix from ::encode() in prior versions
+      dump_header(s, "X-Object-Meta-Static-Large-Object", "True");
     } else if (strncmp(name, RGW_ATTR_META_PREFIX,
                       sizeof(RGW_ATTR_META_PREFIX)-1) == 0) {
       name += sizeof(RGW_ATTR_META_PREFIX) - 1;