]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: send proper ETag value during GET on DLO/SLO through S3 API.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 29 Feb 2016 22:25:57 +0000 (23:25 +0100)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 1 Mar 2016 15:26:33 +0000 (16:26 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_rest_s3.cc

index 9cbbd860aace23c12b2af4b3d86e5b97a189f9d7..fc7a2d9840e84cc2fc6cdc31f02281122c139b06 100644 (file)
@@ -149,12 +149,20 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
   dump_last_modified(s, lastmod);
 
   if (! op_ret) {
-    map<string, bufferlist>::iterator iter = attrs.find(RGW_ATTR_ETAG);
-    if (iter != attrs.end()) {
-      bufferlist& bl = iter->second;
-      if (bl.length()) {
-       char *etag = bl.c_str();
-       dump_etag(s, etag);
+    if (! lo_etag.empty()) {
+      /* Handle etag of Swift API's large objects (DLO/SLO). It's entirerly
+       * legit to perform GET on them through S3 API. In such situation,
+       * a client should receive the composited content with corresponding
+       * etag value. */
+      dump_etag(s, lo_etag.c_str());
+    } else {
+      auto iter = attrs.find(RGW_ATTR_ETAG);
+      if (iter != attrs.end()) {
+        bufferlist& bl = iter->second;
+        if (bl.length()) {
+         const char * etag = bl.c_str();
+         dump_etag(s, etag);
+        }
       }
     }
 
@@ -171,7 +179,7 @@ int RGWGetObj_ObjStore_S3::send_response_data(bufferlist& bl, off_t bl_ofs,
       }
     }
 
-    for (iter = attrs.begin(); iter != attrs.end(); ++iter) {
+    for (auto iter = attrs.begin(); iter != attrs.end(); ++iter) {
       const char *name = iter->first.c_str();
       map<string, string>::iterator aiter = rgw_to_http_attrs.find(name);
       if (aiter != rgw_to_http_attrs.end()) {