From: Radoslaw Zarzynski Date: Wed, 18 Nov 2015 19:15:09 +0000 (+0100) Subject: rgw: add support for normalisation of ranged SLO requests. X-Git-Tag: v10.0.2~36^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=630eac10cfbe8f2b8e0a4015b65aea018bdb525e;p=ceph.git rgw: add support for normalisation of ranged SLO requests. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 7e119aa487c9..906b1663807a 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1052,9 +1052,21 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl) s->obj_size = slo_info.total_size; ldout(s->cct, 20) << "s->obj_size=" << s->obj_size << dendl; - int r = iterate_slo_parts(s->cct, store, start_ofs, end, slo_parts, get_obj_user_manifest_iterate_cb, (void *)this); - if (r < 0) + if (ofs < 0) { + ofs = total_len - std::min(-ofs, static_cast(total_len)); + } + + if (end < 0 || end >= static_cast(total_len)) { + end = total_len - 1; + } + + total_len = end - ofs + 1; + + int r = iterate_slo_parts(s->cct, store, ofs, end, slo_parts, + get_obj_user_manifest_iterate_cb, (void *)this); + if (r < 0) { return r; + } return 0; }