summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-07-30 17:34:49 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-08-01 18:26:47 -0700
commitb139a7cd34b4e203ab164ada7a8fa590b50d8b13 (patch)
tree72fba2a1e6d5d1ab9c99b4a220912f418f897fed
parent00dc634451687756ef16f176753d0bd0ba385584 (diff)
downloadceph-b139a7cd34b4e203ab164ada7a8fa590b50d8b13.tar.gz
rgw: don't read cors attrs if there's no bucket in operation
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
-rw-r--r--src/rgw/rgw_op.cc41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc
index e672de154ab..0c3f4955940 100644
--- a/src/rgw/rgw_op.cc
+++ b/src/rgw/rgw_op.cc
@@ -2514,32 +2514,33 @@ int RGWHandler::read_cors_config(void)
{
int ret = 0;
bufferlist bl;
-
+
+ if (s->bucket.name.empty())
+ return 0;
+
dout(10) << "Going to read cors from attrs" << dendl;
rgw_obj obj;
store->get_bucket_instance_obj(s->bucket, obj);
- if (obj.bucket.name.size()) {
- ret = store->get_attr(s->obj_ctx, obj, RGW_ATTR_CORS, bl);
- if (ret >= 0) {
- bufferlist::iterator iter = bl.begin();
- s->bucket_cors = new RGWCORSConfiguration();
- try {
- s->bucket_cors->decode(iter);
- } catch (buffer::error& err) {
- ldout(s->cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
- return -EIO;
- }
- if (s->cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15)) {
- RGWCORSConfiguration_S3 *s3cors = static_cast<RGWCORSConfiguration_S3 *>(s->bucket_cors);
- ldout(s->cct, 15) << "Read RGWCORSConfiguration";
- s3cors->to_xml(*_dout);
- *_dout << dendl;
- }
- } else {
+ ret = store->get_attr(s->obj_ctx, obj, RGW_ATTR_CORS, bl);
+ if (ret >= 0) {
+ bufferlist::iterator iter = bl.begin();
+ s->bucket_cors = new RGWCORSConfiguration();
+ try {
+ s->bucket_cors->decode(iter);
+ } catch (buffer::error& err) {
+ ldout(s->cct, 0) << "ERROR: could not decode policy, caught buffer::error" << dendl;
+ return -EIO;
+ }
+ if (s->cct->_conf->subsys.should_gather(ceph_subsys_rgw, 15)) {
+ RGWCORSConfiguration_S3 *s3cors = static_cast<RGWCORSConfiguration_S3 *>(s->bucket_cors);
+ ldout(s->cct, 15) << "Read RGWCORSConfiguration";
+ s3cors->to_xml(*_dout);
+ *_dout << dendl;
+ }
+ } else {
/*Not a serious error*/
dout(2) << "Warning: There is no content for CORS xattr,"
" cors may not be set yet" << dendl;
- }
}
return ret;
}