date_str = buffer;
}
-int RGWRESTSimpleRequest::execute(RGWAccessKey& key, const char *_method, const char *resource, optional_yield y)
+int RGWRESTSimpleRequest::execute(const DoutPrefixProvider *dpp, RGWAccessKey& key, const char *_method, const char *resource, optional_yield y)
{
method = _method;
string new_url = url;
meta_map_t meta_map;
map<string, string> sub_resources;
- rgw_create_s3_canonical_header(method.c_str(), NULL, NULL, date_str.c_str(),
+ rgw_create_s3_canonical_header(dpp, method.c_str(), NULL, NULL, date_str.c_str(),
meta_map, meta_map, url.c_str(), sub_resources,
canonical_header);
string auth_hdr = "AWS " + key.id + ":" + digest;
- ldout(cct, 15) << "generated auth header: " << auth_hdr << dendl;
+ ldpp_dout(dpp, 15) << "generated auth header: " << auth_hdr << dendl;
headers.push_back(pair<string, string>("AUTHORIZATION", auth_hdr));
int r = process(y);
out_headers.clear();
}
-static int sign_request(CephContext *cct, RGWAccessKey& key, RGWEnv& env, req_info& info)
+static int sign_request(const DoutPrefixProvider *dpp, CephContext *cct, RGWAccessKey& key, RGWEnv& env, req_info& info)
{
/* don't sign if no key is provided */
if (key.key.empty()) {
}
string canonical_header;
- if (!rgw_create_s3_canonical_header(info, NULL, canonical_header, false)) {
- ldout(cct, 0) << "failed to create canonical s3 header" << dendl;
+ if (!rgw_create_s3_canonical_header(dpp, info, NULL, canonical_header, false)) {
+ ldpp_dout(dpp, 0) << "failed to create canonical s3 header" << dendl;
return -EINVAL;
}
- ldout(cct, 10) << "generated canonical header: " << canonical_header << dendl;
+ ldpp_dout(dpp, 10) << "generated canonical header: " << canonical_header << dendl;
string digest;
try {
}
string auth_hdr = "AWS " + key.id + ":" + digest;
- ldout(cct, 15) << "generated auth header: " << auth_hdr << dendl;
+ ldpp_dout(dpp, 15) << "generated auth header: " << auth_hdr << dendl;
env.set("AUTHORIZATION", auth_hdr);
return 0;
}
-int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, size_t max_response, bufferlist *inbl, bufferlist *outbl, optional_yield y)
+int RGWRESTSimpleRequest::forward_request(const DoutPrefixProvider *dpp, RGWAccessKey& key, req_info& info, size_t max_response, bufferlist *inbl, bufferlist *outbl, optional_yield y)
{
string date_str;
if (content_md5) {
new_env.set("HTTP_CONTENT_MD5", content_md5);
}
- int ret = sign_request(cct, key, new_env, new_info);
+ int ret = sign_request(dpp, cct, key, new_env, new_info);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: failed to sign request" << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: failed to sign request" << dendl;
return ret;
}
}
}
-int RGWRESTGenerateHTTPHeaders::set_obj_attrs(map<string, bufferlist>& rgw_attrs)
+int RGWRESTGenerateHTTPHeaders::set_obj_attrs(const DoutPrefixProvider *dpp, map<string, bufferlist>& rgw_attrs)
{
map<string, string> new_attrs;
}
RGWAccessControlPolicy policy;
- int ret = rgw_policy_from_attrset(cct, rgw_attrs, &policy);
+ int ret = rgw_policy_from_attrset(dpp, cct, rgw_attrs, &policy);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: couldn't get policy ret=" << ret << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: couldn't get policy ret=" << ret << dendl;
return ret;
}
add_grants_headers(grants_by_type, *new_env, new_info->x_meta_map);
}
-int RGWRESTGenerateHTTPHeaders::sign(RGWAccessKey& key)
+int RGWRESTGenerateHTTPHeaders::sign(const DoutPrefixProvider *dpp, RGWAccessKey& key)
{
- int ret = sign_request(cct, key, *new_env, *new_info);
+ int ret = sign_request(dpp, cct, key, *new_env, *new_info);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: failed to sign request" << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: failed to sign request" << dendl;
return ret;
}
url = headers_gen.get_url();
}
-int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, map<string, bufferlist>& rgw_attrs, bool send)
+int RGWRESTStreamS3PutObj::send_ready(const DoutPrefixProvider *dpp, RGWAccessKey& key, map<string, bufferlist>& rgw_attrs, bool send)
{
- headers_gen.set_obj_attrs(rgw_attrs);
+ headers_gen.set_obj_attrs(dpp, rgw_attrs);
- return send_ready(key, send);
+ return send_ready(dpp, key, send);
}
-int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, const map<string, string>& http_attrs,
+int RGWRESTStreamS3PutObj::send_ready(const DoutPrefixProvider *dpp, RGWAccessKey& key, const map<string, string>& http_attrs,
RGWAccessControlPolicy& policy, bool send)
{
headers_gen.set_http_attrs(http_attrs);
headers_gen.set_policy(policy);
- return send_ready(key, send);
+ return send_ready(dpp, key, send);
}
-int RGWRESTStreamS3PutObj::send_ready(RGWAccessKey& key, bool send)
+int RGWRESTStreamS3PutObj::send_ready(const DoutPrefixProvider *dpp, RGWAccessKey& key, bool send)
{
- headers_gen.sign(key);
+ headers_gen.sign(dpp, key);
for (const auto& kv: new_env.get_map()) {
headers.emplace_back(kv);
return 0;
}
-int RGWRESTStreamS3PutObj::put_obj_init(RGWAccessKey& key, rgw::sal::RGWObject* obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send)
+int RGWRESTStreamS3PutObj::put_obj_init(const DoutPrefixProvider *dpp, RGWAccessKey& key, rgw::sal::RGWObject* obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send)
{
send_init(obj);
- return send_ready(key, attrs, send);
+ return send_ready(dpp, key, attrs, send);
}
void set_str_from_headers(map<string, string>& out_headers, const string& header_name, string& str)
*resource = urlsafe_bucket + "/" + urlsafe_object;
}
-int RGWRESTStreamRWRequest::send_request(RGWAccessKey& key, map<string, string>& extra_headers, const rgw_obj& obj, RGWHTTPManager *mgr)
+int RGWRESTStreamRWRequest::send_request(const DoutPrefixProvider *dpp, RGWAccessKey& key, map<string, string>& extra_headers, const rgw_obj& obj, RGWHTTPManager *mgr)
{
string resource;
send_prepare_convert(obj, &resource);
- return send_request(&key, extra_headers, resource, mgr);
+ return send_request(dpp, &key, extra_headers, resource, mgr);
}
-int RGWRESTStreamRWRequest::send_prepare(RGWAccessKey& key, map<string, string>& extra_headers, const rgw_obj& obj)
+int RGWRESTStreamRWRequest::send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey& key, map<string, string>& extra_headers, const rgw_obj& obj)
{
string resource;
send_prepare_convert(obj, &resource);
- return do_send_prepare(&key, extra_headers, resource);
+ return do_send_prepare(dpp, &key, extra_headers, resource);
}
-int RGWRESTStreamRWRequest::send_prepare(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
+int RGWRESTStreamRWRequest::send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
bufferlist *send_data)
{
string new_resource;
//do not encode slash
url_encode(resource, new_resource, false);
- return do_send_prepare(key, extra_headers, new_resource, send_data);
+ return do_send_prepare(dpp, key, extra_headers, new_resource, send_data);
}
-int RGWRESTStreamRWRequest::do_send_prepare(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
+int RGWRESTStreamRWRequest::do_send_prepare(const DoutPrefixProvider *dpp, RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
bufferlist *send_data)
{
string new_url = url;
new_info.init_meta_info(nullptr);
#endif
- int ret = headers_gen.sign(*key);
+ int ret = headers_gen.sign(dpp, *key);
if (ret < 0) {
- ldout(cct, 0) << "ERROR: failed to sign request" << dendl;
+ ldpp_dout(dpp, 0) << "ERROR: failed to sign request" << dendl;
return ret;
}
}
return 0;
}
-int RGWRESTStreamRWRequest::send_request(RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
+int RGWRESTStreamRWRequest::send_request(const DoutPrefixProvider *dpp, RGWAccessKey *key, map<string, string>& extra_headers, const string& resource,
RGWHTTPManager *mgr, bufferlist *send_data)
{
- int ret = send_prepare(key, extra_headers, resource, send_data);
+ int ret = send_prepare(dpp, key, extra_headers, resource, send_data);
if (ret < 0) {
return ret;
}