#include "rgw_rest_client.h"
#include "rgw_auth_s3.h"
#include "rgw_http_errors.h"
-#include "rgw_rados.h"
#include "common/armor.h"
#include "common/strtol.h"
date_str = buffer;
}
-int RGWRESTSimpleRequest::execute(RGWAccessKey& key, const char *_method, const char *resource)
+int RGWRESTSimpleRequest::execute(RGWAccessKey& key, const char *_method, const char *resource, optional_yield y)
{
method = _method;
string new_url = url;
ldout(cct, 15) << "generated auth header: " << auth_hdr << dendl;
headers.push_back(pair<string, string>("AUTHORIZATION", auth_hdr));
- int r = process(null_yield);
+ int r = process(y);
if (r < 0)
return r;
return 0;
}
-int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, size_t max_response, bufferlist *inbl, bufferlist *outbl)
+int RGWRESTSimpleRequest::forward_request(RGWAccessKey& key, req_info& info, size_t max_response, bufferlist *inbl, bufferlist *outbl, optional_yield y)
{
string date_str;
request_uri_encode = string("/") + bucket_encode;
new_info.request_uri = request_uri_encode;
new_env.set("HTTP_DATE", date_str.c_str());
-
+ const char* const content_md5 = info.env->get("HTTP_CONTENT_MD5");
+ if (content_md5) {
+ new_env.set("HTTP_CONTENT_MD5", content_md5);
+ }
int ret = sign_request(cct, key, new_env, new_info);
if (ret < 0) {
ldout(cct, 0) << "ERROR: failed to sign request" << dendl;
method = new_info.method;
url = new_url;
- int r = process(null_yield);
+ int r = process(y);
if (r < 0){
if (r == -EINVAL){
// curl_easy has errored, generally means the service is not available
response.append((char)0); /* NULL terminate response */
if (outbl) {
- outbl->claim(response);
+ *outbl = std::move(response);
}
return status;
return 0;
}
-void RGWRESTStreamS3PutObj::send_init(rgw_obj& obj)
+void RGWRESTStreamS3PutObj::send_init(rgw::sal::RGWObject* obj)
{
string resource_str;
string resource;
string new_url = url;
if (host_style == VirtualStyle) {
- resource_str = obj.get_oid();
- new_url = obj.bucket.name + "." + new_url;
+ resource_str = obj->get_oid();
+ new_url = obj->get_bucket()->get_name() + "." + new_url;
} else {
- resource_str = obj.bucket.name + "/" + obj.get_oid();
+ resource_str = obj->get_bucket()->get_name() + "/" + obj->get_oid();
}
//do not encode slash in object key name
return 0;
}
-int RGWRESTStreamS3PutObj::put_obj_init(RGWAccessKey& key, rgw_obj& obj, uint64_t obj_size, map<string, bufferlist>& attrs, bool send)
+int RGWRESTStreamS3PutObj::put_obj_init(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 0;
}
-int RGWRESTStreamRWRequest::complete_request(string *etag,
+int RGWRESTStreamRWRequest::complete_request(optional_yield y,
+ string *etag,
real_time *mtime,
uint64_t *psize,
map<string, string> *pattrs,
map<string, string> *pheaders)
{
- int ret = wait(null_yield);
+ int ret = wait(y);
if (ret < 0) {
return ret;
}