From 7e1553cedff90fa0fefded65cde87ad068eb5f0c 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 --- 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 960cf9c3d02c..20ac37e9990b 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -559,7 +559,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; @@ -601,11 +600,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) { @@ -619,7 +614,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.47.3