]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: send Content-Length in response for GET on Swift account.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 25 Jun 2015 16:28:50 +0000 (18:28 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 6 Oct 2015 09:00:37 +0000 (11:00 +0200)
Fixes: #12158
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit 5f47b11791cd46ce2771046e4888575869cc9685)

Conflicts:
src/rgw/rgw_rest_swift.cc
            omit dump_account_metadata() call

src/common/config_opts.h
src/rgw/rgw_rest_swift.cc

index 315ac82c5e57764026edf93769a81dfdba15072c..ee8fc9de0195a14111ca1a21c5d9129468f8c5e2 100644 (file)
@@ -789,6 +789,7 @@ OPTION(rgw_swift_url_prefix, OPT_STR, "swift") // entry point for which a url is
 OPTION(rgw_swift_auth_url, OPT_STR, "")        // default URL to go and verify tokens for v1 auth (if not using internal swift auth)
 OPTION(rgw_swift_auth_entry, OPT_STR, "auth")  // entry point for which a url is considered a swift auth url
 OPTION(rgw_swift_tenant_name, OPT_STR, "")  // tenant name to use for swift access
+OPTION(rgw_swift_enforce_content_length, OPT_BOOL, false)  // enforce generation of Content-Length even in cost of performance or scalability
 OPTION(rgw_keystone_url, OPT_STR, "")  // url for keystone server
 OPTION(rgw_keystone_admin_token, OPT_STR, "")  // keystone admin token (shared secret)
 OPTION(rgw_keystone_admin_user, OPT_STR, "")  // keystone admin user name
index a89c5d0b669e20556e93fa610743552baa36e4dd..4e4475a8ffb9c5664d8f435a24c8803e6e81ca88 100644 (file)
@@ -51,8 +51,11 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)
     ret = STATUS_NO_CONTENT;
     set_req_state_err(s, ret);
   }
-  dump_errno(s);
-  end_header(s, NULL, NULL, true);
+
+  if (!g_conf->rgw_swift_enforce_content_length) {
+    dump_errno(s);
+    end_header(s, NULL, NULL, NO_CONTENT_LENGTH, true);
+  }
 
   if (!ret) {
     dump_start(s);
@@ -79,7 +82,9 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_data(RGWUserBuckets& buckets)
       s->formatter->dump_int("bytes", obj.size);
     }
     s->formatter->close_section();
-    rgw_flush_formatter(s, s->formatter);
+    if (!g_conf->rgw_swift_enforce_content_length) {
+      rgw_flush_formatter(s, s->formatter);
+    }
   }
 }
 
@@ -87,6 +92,14 @@ void RGWListBuckets_ObjStore_SWIFT::send_response_end()
 {
   if (sent_data) {
     s->formatter->close_section();
+  }
+
+  if (g_conf->rgw_swift_enforce_content_length) {
+    dump_errno(s);
+    end_header(s, NULL, NULL, s->formatter->get_len(), true);
+  }
+
+  if (sent_data || g_conf->rgw_swift_enforce_content_length) {
     rgw_flush_formatter_and_reset(s, s->formatter);
   }
 }