diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-07-30 17:34:49 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-07-31 10:48:15 -0700 |
commit | 69b8afc92611ec5f5abee1e8717c299da6c83d09 (patch) | |
tree | 72fba2a1e6d5d1ab9c99b4a220912f418f897fed | |
parent | 00dc634451687756ef16f176753d0bd0ba385584 (diff) | |
download | ceph-69b8afc92611ec5f5abee1e8717c299da6c83d09.tar.gz |
rgw: don't read cors attrs if there's no bucket in operationwip-rgw-next
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_op.cc | 41 |
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; } |