1
0
mirror of https://github.com/ceph/ceph synced 2024-12-29 23:12:27 +00:00

rgw: swift list containers can return 204

In order to keep compatibility with swift, if a plain formatter
is being used, we should return 204 when there are no containers.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
This commit is contained in:
Yehuda Sadeh 2013-04-25 21:58:02 -07:00
parent 960eac2600
commit 2264078a61
6 changed files with 12 additions and 8 deletions

View File

@ -666,7 +666,7 @@ void RGWListBuckets::execute()
marker, read_count, should_get_stats());
if (!started) {
send_response_begin();
send_response_begin(buckets.count() > 0);
started = true;
}
@ -692,7 +692,7 @@ void RGWListBuckets::execute()
send_end:
if (!started) {
send_response_begin();
send_response_begin(false);
}
send_response_end();
}

View File

@ -140,7 +140,7 @@ public:
void execute();
virtual int get_params() = 0;
virtual void send_response_begin() = 0;
virtual void send_response_begin(bool has_buckets) = 0;
virtual void send_response_data(RGWUserBuckets& buckets) = 0;
virtual void send_response_end() = 0;
virtual void send_response() {}

View File

@ -156,7 +156,7 @@ send_data:
return 0;
}
void RGWListBuckets_ObjStore_S3::send_response_begin()
void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets)
{
if (ret)
set_req_state_err(s, ret);

View File

@ -26,7 +26,7 @@ public:
~RGWListBuckets_ObjStore_S3() {}
int get_params() { return 0; }
virtual void send_response_begin();
virtual void send_response_begin(bool has_buckets);
virtual void send_response_data(RGWUserBuckets& buckets);
virtual void send_response_end();
};

View File

@ -43,10 +43,14 @@ int RGWListBuckets_ObjStore_SWIFT::get_params()
return 0;
}
void RGWListBuckets_ObjStore_SWIFT::send_response_begin()
void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)
{
if (ret)
if (ret) {
set_req_state_err(s, ret);
} else if (!has_buckets && s->format == RGW_FORMAT_PLAIN) {
ret = STATUS_NO_CONTENT;
set_req_state_err(s, ret);
}
dump_errno(s);
end_header(s);

View File

@ -20,7 +20,7 @@ public:
~RGWListBuckets_ObjStore_SWIFT() {}
int get_params();
void send_response_begin();
void send_response_begin(bool has_buckets);
void send_response_data(RGWUserBuckets& buckets);
void send_response_end();