]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: es: use default request headers for query requests 26106/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:15:56 +0000 (15:15 -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 8723c5f6f98519e044db1170d6b4af12cddf7cb9..f9b02a4027bbfa917ef413f3ca25600f1a90515d 100644 (file)
@@ -211,6 +211,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));
   }
@@ -834,6 +838,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 JSONFormattable& config)
@@ -855,6 +863,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 1b5506c35799d1a6a9c6db7f4ba0f40f5b06701c..cb5c9106225084f46bf2da6cabf1999413d5556d 100644 (file)
@@ -53,6 +53,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();
   bool supports_user_writes() override {
     return true;
   }
index 8a8d895b3265041d419298d564124462b45d1815..751d822085f26b7eafb56e620b5be2cb70f2d167 100644 (file)
@@ -245,7 +245,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;