]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix partial GET in swift
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 16 Jan 2015 00:31:22 +0000 (16:31 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 30 Jan 2015 19:28:09 +0000 (11:28 -0800)
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 <yehuda@redhat.com>
(cherry picked from commit 7e1553cedff90fa0fefded65cde87ad068eb5f0c)

src/rgw/rgw_rest_swift.cc

index e1cfedf6d46b4c79efe9b2284e7e0a8a3c5c8338..e04e2c0cdd2d8004b538e99774c00d1884e25e01 100644 (file)
@@ -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<string, string> response_attrs;
   map<string, string>::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;