diff --git a/src/rgw/rgw_rest_swift.cc b/src/rgw/rgw_rest_swift.cc index 8f56a64ae38..e10d0de6001 100644 --- a/src/rgw/rgw_rest_swift.cc +++ b/src/rgw/rgw_rest_swift.cc @@ -601,6 +601,20 @@ void RGWCopyObj_ObjStore_SWIFT::send_partial_response(off_t ofs) rgw_flush_formatter(s, s->formatter); } +void RGWCopyObj_ObjStore_SWIFT::dump_copy_info() +{ + /* Dump X-Copied-From */ + string objname, bucketname; + url_encode(src_object.name, objname); + url_encode(src_bucket.name, bucketname); + s->cio->print("X-Copied-From: %s/%s\r\n", bucketname.c_str(), objname.c_str()); + + /* Dump X-Copied-From-Account */ + string account_name; + url_encode(s->user.user_id, account_name); + s->cio->print("X-Copied-From-Account: %s\r\n", account_name.c_str()); +} + void RGWCopyObj_ObjStore_SWIFT::send_response() { if (!sent_header) { @@ -610,6 +624,7 @@ void RGWCopyObj_ObjStore_SWIFT::send_response() dump_errno(s); dump_etag(s, etag.c_str()); dump_last_modified(s, mtime); + dump_copy_info(); end_header(s, this); } else { s->formatter->close_section(); diff --git a/src/rgw/rgw_rest_swift.h b/src/rgw/rgw_rest_swift.h index 811bf0deaea..e722a2f6f48 100644 --- a/src/rgw/rgw_rest_swift.h +++ b/src/rgw/rgw_rest_swift.h @@ -114,6 +114,8 @@ public: class RGWCopyObj_ObjStore_SWIFT : public RGWCopyObj_ObjStore { bool sent_header; +protected: + void dump_copy_info(); public: RGWCopyObj_ObjStore_SWIFT() : sent_header(false) {} ~RGWCopyObj_ObjStore_SWIFT() {}