mirror of
https://github.com/ceph/ceph
synced 2025-01-02 00:52:22 +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:
parent
960eac2600
commit
2264078a61
@ -666,7 +666,7 @@ void RGWListBuckets::execute()
|
|||||||
marker, read_count, should_get_stats());
|
marker, read_count, should_get_stats());
|
||||||
|
|
||||||
if (!started) {
|
if (!started) {
|
||||||
send_response_begin();
|
send_response_begin(buckets.count() > 0);
|
||||||
started = true;
|
started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,7 +692,7 @@ void RGWListBuckets::execute()
|
|||||||
|
|
||||||
send_end:
|
send_end:
|
||||||
if (!started) {
|
if (!started) {
|
||||||
send_response_begin();
|
send_response_begin(false);
|
||||||
}
|
}
|
||||||
send_response_end();
|
send_response_end();
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
void execute();
|
void execute();
|
||||||
|
|
||||||
virtual int get_params() = 0;
|
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_data(RGWUserBuckets& buckets) = 0;
|
||||||
virtual void send_response_end() = 0;
|
virtual void send_response_end() = 0;
|
||||||
virtual void send_response() {}
|
virtual void send_response() {}
|
||||||
|
@ -156,7 +156,7 @@ send_data:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGWListBuckets_ObjStore_S3::send_response_begin()
|
void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets)
|
||||||
{
|
{
|
||||||
if (ret)
|
if (ret)
|
||||||
set_req_state_err(s, ret);
|
set_req_state_err(s, ret);
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
~RGWListBuckets_ObjStore_S3() {}
|
~RGWListBuckets_ObjStore_S3() {}
|
||||||
|
|
||||||
int get_params() { return 0; }
|
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_data(RGWUserBuckets& buckets);
|
||||||
virtual void send_response_end();
|
virtual void send_response_end();
|
||||||
};
|
};
|
||||||
|
@ -43,10 +43,14 @@ int RGWListBuckets_ObjStore_SWIFT::get_params()
|
|||||||
return 0;
|
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);
|
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);
|
dump_errno(s);
|
||||||
end_header(s);
|
end_header(s);
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public:
|
|||||||
~RGWListBuckets_ObjStore_SWIFT() {}
|
~RGWListBuckets_ObjStore_SWIFT() {}
|
||||||
|
|
||||||
int get_params();
|
int get_params();
|
||||||
void send_response_begin();
|
void send_response_begin(bool has_buckets);
|
||||||
void send_response_data(RGWUserBuckets& buckets);
|
void send_response_data(RGWUserBuckets& buckets);
|
||||||
void send_response_end();
|
void send_response_end();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user