]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: es: use default request headers for query requests 26516/head
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 30 Jan 2019 23:15:56 +0000 (15:15 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 30 Jan 2019 23:23:36 +0000 (15:23 -0800)
Needed for sending auth headers.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_sync_module_es.cc
src/rgw/rgw_sync_module_es.h
src/rgw/rgw_sync_module_es_rest.cc

index 98251c87836bc18d80fb80977dcce4e607556079..54e338f4915d0855fd48269d3561ad2e682a21d6 100644 (file)
@@ -208,6 +208,10 @@ struct ElasticConfig {
     return index_path;
   }
 
+  map<string, string>& get_request_headers() {
+    return default_headers;
+  }
+
   string get_obj_path(const RGWBucketInfo& bucket_info, const rgw_obj_key& key) {
     return index_path +  "/object/" + url_encode(bucket_info.bucket.bucket_id + ":" + key.name + ":" + (key.instance.empty() ? "null" : key.instance));
   }
@@ -821,6 +825,10 @@ public:
   string get_index_path() {
     return conf->get_index_path();
   }
+
+  map<string, string>& get_request_headers() {
+    return conf->get_request_headers();
+  }
 };
 
 RGWElasticSyncModuleInstance::RGWElasticSyncModuleInstance(CephContext *cct, const map<string, string, ltstr_nocase>& config)
@@ -842,6 +850,10 @@ string RGWElasticSyncModuleInstance::get_index_path() {
   return data_handler->get_index_path();
 }
 
+map<string, string>& RGWElasticSyncModuleInstance::get_request_headers() {
+  return data_handler->get_request_headers();
+}
+
 RGWRESTMgr *RGWElasticSyncModuleInstance::get_rest_filter(int dialect, RGWRESTMgr *orig) {
   if (dialect != RGW_REST_S3) {
     return orig;
index 7e597681c52a1b385ff4ea5e46657b3e0ee46386..5436733ac3deea5c35c35856754a3306ca786932 100644 (file)
@@ -50,6 +50,7 @@ public:
   RGWRESTMgr *get_rest_filter(int dialect, RGWRESTMgr *orig) override;
   RGWRESTConn *get_rest_conn();
   std::string get_index_path();
+  map<string, string>& get_request_headers();
 };
 
 #endif
index f3286a4f5d6d889477ee640549c7aa6373b7648a..192d20fa1175bb3f306d21e70331fd0a1b9b5ff1 100644 (file)
@@ -243,7 +243,7 @@ void RGWMetadataSearchOp::execute()
     params.push_back(param_pair_t("from", marker_str.c_str()));
   }
   ldout(s->cct, 20) << "sending request to elasticsearch, payload=" << string(in.c_str(), in.length()) << dendl;
-  map<string, string> extra_headers = {{"Content-Type", "application/json"}};
+  auto& extra_headers = es_module->get_request_headers();
   op_ret = conn->get_resource(resource, &params, &extra_headers, out, &in);
   if (op_ret < 0) {
     ldout(s->cct, 0) << "ERROR: failed to fetch resource (r=" << resource << ", ret=" << op_ret << ")" << dendl;