From 3bf42af2e932a473b19cb54637e8543a666a4a28 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 15 Jan 2015 16:31:22 -0800 Subject: [PATCH] rgw: fix partial GET in swift Fixes: #10553 backport: firefly, giant Don't set the ret code to reflect partial download, just set the response status when needed. Signed-off-by: Yehuda Sadeh (cherry picked from commit 7e1553cedff90fa0fefded65cde87ad068eb5f0c) --- src/rgw/rgw_rest_swift.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index e1cfedf6d46b4..e04e2c0cdd2d8 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -554,7 +554,6 @@ void RGWCopyObj_ObjStore_SWIFT::send_response() int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) { const char *content_type = NULL; - int orig_ret = ret; map response_attrs; map::iterator riter; @@ -595,11 +594,7 @@ int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs, o } } - if (partial_content && !ret) - ret = -STATUS_PARTIAL_CONTENT; - - if (ret) - set_req_state_err(s, ret); + set_req_state_err(s, (partial_content && !ret) ? STATUS_PARTIAL_CONTENT : ret); dump_errno(s); for (riter = response_attrs.begin(); riter != response_attrs.end(); ++riter) { @@ -613,7 +608,7 @@ int RGWGetObj_ObjStore_SWIFT::send_response_data(bufferlist& bl, off_t bl_ofs, o sent_header = true; send_data: - if (get_data && !orig_ret) { + if (get_data && !ret) { int r = s->cio->write(bl.c_str() + bl_ofs, bl_len); if (r < 0) return r; -- 2.39.5