mirror of
https://github.com/ceph/ceph
synced 2025-01-03 01:22:53 +00:00
rgw: add support for X-Copied-From{-Account} headers of Swift API.
Fixes: #10663 Backport: hammer Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
This commit is contained in:
parent
385fe4b4bb
commit
94f1375ccb
@ -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();
|
||||
|
@ -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() {}
|
||||
|
Loading…
Reference in New Issue
Block a user