RGWHTTPManager *http_manager;
string path;
param_vec_t params;
- public:
+ param_vec_t extra_headers;
+public:
boost::intrusive_ptr<RGWRESTReadResource> http_op;
RGWReadRawRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
RGWHTTPManager *_http_manager, const string& _path,
path(_path), params(make_param_list(params))
{}
+ RGWReadRawRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
+ RGWHTTPManager *_http_manager, const string& _path,
+ rgw_http_param_pair *params, param_vec_t &hdrs)
+ : RGWSimpleCoroutine(_cct), conn(_conn), http_manager(_http_manager),
+ path(_path), params(make_param_list(params)),
+ extra_headers(hdrs)
+ {}
+
+ RGWReadRawRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
+ RGWHTTPManager *_http_manager, const string& _path,
+ rgw_http_param_pair *params,
+ std::map <std::string, std::string> *hdrs)
+ : RGWSimpleCoroutine(_cct), conn(_conn), http_manager(_http_manager),
+ path(_path), params(make_param_list(params)),
+ extra_headers(make_param_list(hdrs))
+ {}
+
~RGWReadRawRESTResourceCR() override {
request_cleanup();
int send_request() override {
auto op = boost::intrusive_ptr<RGWRESTReadResource>(
- new RGWRESTReadResource(conn, path, params, NULL, http_manager));
+ new RGWRESTReadResource(conn, path, params, &extra_headers, http_manager));
init_new_io(op.get());
: RGWReadRawRESTResourceCR(_cct, _conn, _http_manager, _path, params), result(_result)
{}
+ RGWReadRESTResourceCR(CephContext *_cct, RGWRESTConn *_conn,
+ RGWHTTPManager *_http_manager, const string& _path,
+ rgw_http_param_pair *params,
+ std::map <std::string, std::string> *hdrs,
+ T *_result)
+ : RGWReadRawRESTResourceCR(_cct, _conn, _http_manager, _path, params, hdrs), result(_result)
+ {}
+
int wait_result() override {
return http_op->wait(result);
}
int operate() override {
reenter(this) {
ldout(sync_env->cct, 0) << ": init elasticsearch config zone=" << sync_env->source_zone << dendl;
- yield call(new RGWReadRESTResourceCR<ESInfo> (sync_env->cct,
- conf->conn.get(),
- sync_env->http_manager,
- "/", nullptr, &es_info));
+ yield {
+ auto hdrs = make_param_list(&conf->default_headers);
+ call(new RGWReadRESTResourceCR<ESInfo> (sync_env->cct,
+ conf->conn.get(),
+ sync_env->http_manager,
+ "/", nullptr /*params*/,
+ &hdrs,
+ &es_info));
+ }
if (retcode < 0) {
return set_cr_error(retcode);
}