From: Yehuda Sadeh Date: Tue, 21 Mar 2017 22:02:32 +0000 (-0700) Subject: rgw: extend interfaces to allow sending data X-Git-Tag: ses5-milestone6~9^2~3^2~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=698763fb136015742094321118d07b371c0c4eea;p=ceph.git rgw: extend interfaces to allow sending data when retrieving REST resource Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc index c8d0682a0a42..6496f129d792 100644 --- a/src/rgw/rgw_rest_conn.cc +++ b/src/rgw/rgw_rest_conn.cc @@ -225,6 +225,7 @@ int RGWRESTConn::get_resource(const string& resource, param_vec_t *extra_params, map *extra_headers, bufferlist& bl, + bufferlist *send_data, RGWHTTPManager *mgr) { string url; @@ -249,7 +250,7 @@ int RGWRESTConn::get_resource(const string& resource, headers.insert(extra_headers->begin(), extra_headers->end()); } - ret = req.send_request(&key, headers, resource, nullptr, mgr); + ret = req.send_request(&key, headers, resource, send_data, mgr); if (ret < 0) { ldout(cct, 5) << __func__ << ": send_request() resource=" << resource << " returned ret=" << ret << dendl; return ret; diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h index bec829d6939b..f4a1005b6a3d 100644 --- a/src/rgw/rgw_rest_conn.h +++ b/src/rgw/rgw_rest_conn.h @@ -100,8 +100,12 @@ public: int get_resource(const string& resource, param_vec_t *extra_params, map* extra_headers, - bufferlist& bl, RGWHTTPManager *mgr = NULL); + bufferlist& bl, + bufferlist *send_data = nullptr, + RGWHTTPManager *mgr = nullptr); + template + int get_json_resource(const string& resource, param_vec_t *params, bufferlist *in_data, T& t); template int get_json_resource(const string& resource, param_vec_t *params, T& t); template @@ -110,10 +114,10 @@ public: template -int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, T& t) +int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, bufferlist *in_data, T& t) { bufferlist bl; - int ret = get_resource(resource, params, NULL, bl); + int ret = get_resource(resource, params, nullptr, bl, in_data); if (ret < 0) { return ret; } @@ -126,6 +130,12 @@ int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, return 0; } +template +int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, T& t) +{ + return get_json_resource(resource, params, nullptr, t); +} + template int RGWRESTConn::get_json_resource(const string& resource, const rgw_http_param_pair *pp, T& t) {