]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: send Content-Length in response for GET on Swift account. 5718/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Thu, 25 Jun 2015 16:28:50 +0000 (18:28 +0200)
committerLoic Dachary <ldachary@redhat.com>
Thu, 3 Sep 2015 11:28:50 +0000 (13:28 +0200)
Fixes: #12158
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
(cherry picked from commit 5f47b11791cd46ce2771046e4888575869cc9685)
Conflicts:
src/rgw/rgw_rest_swift.cc

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

index 69a8cb65ff14f3b17f3367c2f7a571e83c0c56bc..33a1e7876aa7ae556bf7d942cf04023a72bd88df 100644 (file)
@@ -960,6 +960,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 012f5003ee532a7b4889f2b49f58187c239b7dbb..b519c46bfa0b308b6c589eb3dcce51dc75c1ef79 100644 (file)
@@ -53,8 +53,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);
@@ -82,7 +85,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);
+    }
   }
 }
 
@@ -90,6 +95,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);
   }
 }