]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: make frontend map optional for ssl init
authorAbhishek Lekshmanan <abhishek@suse.com>
Tue, 27 Feb 2018 22:11:30 +0000 (23:11 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Fri, 2 Mar 2018 16:42:00 +0000 (17:42 +0100)
Since rgw admin also needs to init curl globally where we don't have a frontend
map

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/rgw_http_client_curl.cc
src/rgw/rgw_http_client_curl.h

index 27240caf5b43af4f863c554ce64633ae1b8f5c47..fdb4c48c3a955edf9b6e3ad0ff60a7324c6020db 100644 (file)
@@ -65,7 +65,6 @@ void init_ssl(){
 
 namespace rgw {
 namespace curl {
-std::once_flag curl_init_flag;
 
 static void check_curl()
 {
@@ -80,15 +79,17 @@ void init_ssl() {
   ::openssl::init_ssl();
 }
 
-bool fe_inits_ssl(const fe_map_t& m, long& curl_global_flags){
-  for (const auto& kv: m){
-    if (kv.first == "civetweb" || kv.first == "beast"){
-      std::string cert;
-      kv.second->get_val("ssl_certificate","", &cert);
-      if (!cert.empty()){
-       /* TODO this flag is no op for curl > 7.57 */
-       curl_global_flags &= ~CURL_GLOBAL_SSL;
-       return true;
+bool fe_inits_ssl(boost::optional <const fe_map_t&> m, long& curl_global_flags){
+  if (m) {
+    for (const auto& kv: *m){
+      if (kv.first == "civetweb" || kv.first == "beast"){
+        std::string cert;
+        kv.second->get_val("ssl_certificate","", &cert);
+        if (!cert.empty()){
+         /* TODO this flag is no op for curl > 7.57 */
+          curl_global_flags &= ~CURL_GLOBAL_SSL;
+          return true;
+        }
       }
     }
   }
@@ -96,7 +97,9 @@ bool fe_inits_ssl(const fe_map_t& m, long& curl_global_flags){
 }
 #endif // WITH_CURL_OPENSSL
 
-void setup_curl(const fe_map_t& m) {
+std::once_flag curl_init_flag;
+
+void setup_curl(boost::optional<const fe_map_t&> m) {
   check_curl();
 
   long curl_global_flags = CURL_GLOBAL_ALL;
index fe44dfcedb98c2da719689a1f86ca84b35856bbf..aad61950e9ec65d7988782b5bef94846c857d665 100644 (file)
 #define RGW_HTTP_CLIENT_CURL_H
 
 #include <map>
+#include <boost/optional.hpp>
 #include "rgw_frontend.h"
 
 namespace rgw {
 namespace curl {
 using fe_map_t = std::multimap <std::string, RGWFrontendConfig *>;
 
-void setup_curl(const fe_map_t& m);
+void setup_curl(boost::optional<const fe_map_t&> m);
 void cleanup_curl();
 }
 }