]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
For zero sized objects, let the range adhere as per the RFC
authorroot <root@ceph-node1.homeoffice.wal-mart.com>
Wed, 27 Jul 2016 12:34:19 +0000 (18:04 +0530)
committerroot <root@ceph-node1.homeoffice.wal-mart.com>
Mon, 1 Aug 2016 15:22:45 +0000 (20:52 +0530)
Signed-off-by: Pavan Rallabhandi <PRallabhandi@walmartlabs.com>
src/rgw/rgw_rest.cc

index c99bd79d59d9f827314c23b59844165ec1fc939a..588344f88792d4c63f018772bf5e0c0676c82f10 100644 (file)
@@ -655,7 +655,9 @@ void end_header(struct req_state* s, RGWOp* op, const char *content_type,
       s->formatter->close_section();
     }
     s->formatter->output_footer();
-    dump_content_length(s, s->formatter->get_len());
+    if (s->obj_size) {
+      dump_content_length(s, s->formatter->get_len());
+    }
   } else {
     if (proposed_content_length != NO_CONTENT_LENGTH) {
       dump_content_length(s, proposed_content_length);
@@ -769,8 +771,13 @@ void dump_range(struct req_state *s, uint64_t ofs, uint64_t end,
 
   /* dumping range into temp buffer first, as libfcgi will fail to digest
    * %lld */
-  snprintf(range_buf, sizeof(range_buf), "%lld-%lld/%lld", (long long)ofs,
-          (long long)end, (long long)total);
+
+  if (!total) {
+    snprintf(range_buf, sizeof(range_buf), "*/%lld", (long long)total);
+  } else {
+    snprintf(range_buf, sizeof(range_buf), "%lld-%lld/%lld", (long long)ofs,
+               (long long)end, (long long)total);
+  }
   int r = STREAM_IO(s)->print("Content-Range: bytes %s\r\n", range_buf);
   if (r < 0) {
     ldout(s->cct, 0) << "ERROR: s->cio->print() returned err=" << r << dendl;