]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/s3website: Fix x-amz-website-redirect-location support.
authorRobin H. Johnson <robin.johnson@dreamhost.com>
Sun, 17 Apr 2016 15:23:23 +0000 (08:23 -0700)
committerRobin H. Johnson <robin.johnson@dreamhost.com>
Tue, 7 Jun 2016 20:28:41 +0000 (13:28 -0700)
Support for the x-amz-website-redirect-location header was broken in the
feature merging of Jewel, as it previously depended on the error handler to
redirect, which was overkill. Simplify it to work.

Backport: jewel
Fixes: http://tracker.ceph.com/issues/15531
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.com>
(cherry picked from commit 7cbb63bb748c4c78c02926acb4ad9bcea5593695)

src/rgw/rgw_rest_s3.cc

index 2667cf4fd5ed3c9b052607e02e3344f4e9a8341f..518ad2ba1a2906a1851f44f0d64ea446efafcbf4 100644 (file)
@@ -92,8 +92,13 @@ int RGWGetObj_ObjStore_S3Website::send_response_data(bufferlist& bl, off_t bl_of
     bufferlist &bl = iter->second;
     s->redirect = string(bl.c_str(), bl.length());
     s->err.http_ret = 301;
-    ldout(s->cct, 20) << __CEPH_ASSERT_FUNCTION << " redirectng per x-amz-website-redirect-location=" << s->redirect << dendl;
+    ldout(s->cct, 20) << __CEPH_ASSERT_FUNCTION << " redirecting per x-amz-website-redirect-location=" << s->redirect << dendl;
     op_ret = -ERR_WEBSITE_REDIRECT;
+    set_req_state_err(s, op_ret);
+    dump_errno(s);
+    dump_content_length(s, 0);
+    dump_redirect(s, s->redirect);
+    end_header(s, this);
     return op_ret;
   } else {
     return RGWGetObj_ObjStore_S3::send_response_data(bl, bl_ofs, bl_len);