Skip to content

Commit

Permalink
For zero sized objects, let the range adhere as per the RFC
Browse files Browse the repository at this point in the history
Signed-off-by: Pavan Rallabhandi <PRallabhandi@walmartlabs.com>
  • Loading branch information
root committed Jul 26, 2016
1 parent da5bc8d commit 0fc7353
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/rgw/rgw_rest.cc
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0fc7353

Please sign in to comment.