return status;
}
-int RGWRESTStreamRWRequest::get_obj(RGWAccessKey& key, map<string, string>& extra_headers, rgw_obj& obj)
+int RGWRESTStreamRWRequest::send_request(RGWAccessKey& key, map<string, string>& extra_headers, rgw_obj& obj, RGWHTTPManager *mgr)
{
string urlsafe_bucket, urlsafe_object;
url_encode(obj.bucket.get_key(':', 0), urlsafe_bucket);
url_encode(obj.key.name, urlsafe_object);
string resource = urlsafe_bucket + "/" + urlsafe_object;
- return get_resource(key, extra_headers, resource);
+ return send_request(key, extra_headers, resource, mgr);
}
-int RGWRESTStreamRWRequest::get_resource(RGWAccessKey& key, map<string, string>& extra_headers, const string& resource, RGWHTTPManager *mgr)
+int RGWRESTStreamRWRequest::send_request(RGWAccessKey& key, map<string, string>& extra_headers, const string& resource, RGWHTTPManager *mgr)
{
string new_url = url;
if (new_url[new_url.size() - 1] != '/')
return 0;
}
-int RGWRESTStreamRWRequest::complete(string& etag, real_time *mtime, uint64_t *psize, map<string, string>& attrs)
+int RGWRESTStreamRWRequest::complete_request(string& etag, real_time *mtime, uint64_t *psize, map<string, string>& attrs)
{
set_str_from_headers(out_headers, "ETAG", etag);
if (status >= 0) {
lock("RGWRESTStreamReadRequest"), cb(_cb),
chunk_ofs(0), ofs(0), http_manager(_cct), method(_method), write_ofs(0) {
}
- ~RGWRESTStreamRWRequest() override {}
- int get_obj(RGWAccessKey& key, map<string, string>& extra_headers, rgw_obj& obj);
- int get_resource(RGWAccessKey& key, map<string, string>& extra_headers, const string& resource, RGWHTTPManager *mgr = NULL);
- int complete(string& etag, real_time *mtime, uint64_t *psize, map<string, string>& attrs);
+ virtual ~RGWRESTStreamRWRequest() override {}
+ int send_request(RGWAccessKey& key, map<string, string>& extra_headers, rgw_obj& obj, RGWHTTPManager *mgr = NULL);
+ int send_request(RGWAccessKey& key, map<string, string>& extra_headers, const string& resource, RGWHTTPManager *mgr = NULL);
+ int complete_request(string& etag, real_time *mtime, uint64_t *psize, map<string, string>& attrs);
void set_outbl(bufferlist& _outbl) {
outbl.swap(_outbl);
set_header(mod_pg_ver, extra_headers, "HTTP_DEST_PG_VER");
}
- int r = (*req)->get_obj(key, extra_headers, obj);
+ int r = (*req)->send_request(key, extra_headers, obj);
if (r < 0) {
delete *req;
*req = nullptr;
int RGWRESTConn::complete_request(RGWRESTStreamRWRequest *req, string& etag, real_time *mtime,
uint64_t *psize, map<string, string>& attrs)
{
- int ret = req->complete(etag, mtime, psize, attrs);
+ int ret = req->complete_request(etag, mtime, psize, attrs);
delete req;
return ret;
headers.insert(extra_headers->begin(), extra_headers->end());
}
- ret = req.get_resource(key, headers, resource, mgr);
+ ret = req.send_request(key, headers, resource, mgr);
if (ret < 0) {
- ldout(cct, 5) << __func__ << ": get_resource() resource=" << resource << " returned ret=" << ret << dendl;
+ ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
return ret;
}
string etag;
map<string, string> attrs;
- return req.complete(etag, NULL, NULL, attrs);
+ return req.complete_request(etag, NULL, NULL, attrs);
}
RGWRESTReadResource::RGWRESTReadResource(RGWRESTConn *_conn,
int RGWRESTReadResource::read()
{
- int ret = req.get_resource(conn->get_key(), headers, resource, mgr);
+ int ret = req.send_request(conn->get_key(), headers, resource, mgr);
if (ret < 0) {
- ldout(cct, 5) << __func__ << ": get_resource() resource=" << resource << " returned ret=" << ret << dendl;
+ ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
return ret;
}
string etag;
map<string, string> attrs;
- return req.complete(etag, NULL, NULL, attrs);
+ return req.complete_request(etag, NULL, NULL, attrs);
}
int RGWRESTReadResource::aio_read()
{
- int ret = req.get_resource(conn->get_key(), headers, resource, mgr);
+ int ret = req.send_request(conn->get_key(), headers, resource, mgr);
if (ret < 0) {
- ldout(cct, 5) << __func__ << ": get_resource() resource=" << resource << " returned ret=" << ret << dendl;
+ ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
return ret;
}
int RGWRESTSendResource::send(bufferlist& outbl)
{
req.set_outbl(outbl);
- int ret = req.get_resource(conn->get_key(), headers, resource, mgr);
+ int ret = req.send_request(conn->get_key(), headers, resource, mgr);
if (ret < 0) {
- ldout(cct, 5) << __func__ << ": get_resource() resource=" << resource << " returned ret=" << ret << dendl;
+ ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
return ret;
}
string etag;
map<string, string> attrs;
- return req.complete(etag, NULL, NULL, attrs);
+ return req.complete_request(etag, NULL, NULL, attrs);
}
int RGWRESTSendResource::aio_send(bufferlist& outbl)
{
req.set_outbl(outbl);
- int ret = req.get_resource(conn->get_key(), headers, resource, mgr);
+ int ret = req.send_request(conn->get_key(), headers, resource, mgr);
if (ret < 0) {
- ldout(cct, 5) << __func__ << ": get_resource() resource=" << resource << " returned ret=" << ret << dendl;
+ ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl;
return ret;
}