diff --git a/gtk2_ardour/ardour_http.cc b/gtk2_ardour/ardour_http.cc index 03cf3102f5..af0fa8a092 100644 --- a/gtk2_ardour/ardour_http.cc +++ b/gtk2_ardour/ardour_http.cc @@ -52,6 +52,20 @@ using namespace ArdourCurl; const char* HttpGet::ca_path = NULL; const char* HttpGet::ca_info = NULL; +void +HttpGet::ca_setopt (CURL* c) +{ + if (ca_info) { + curl_easy_setopt (c, CURLOPT_CAINFO, ca_info); + } + if (ca_path) { + curl_easy_setopt (c, CURLOPT_CAPATH, ca_path); + } + if (ca_info || ca_path) { + curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 1); + } +} + void HttpGet::setup_certificate_paths () { @@ -162,15 +176,8 @@ HttpGet::HttpGet (bool p, bool ssl) // cc= curl_easy_setopt (_curl, CURLOPT_FOLLOWLOCATION, 1); CCERR ("CURLOPT_FOLLOWLOCATION"); // by default use curl's default. - if (ssl && ca_info) { - curl_easy_setopt (_curl, CURLOPT_CAINFO, ca_info); - } - if (ssl && ca_path) { - curl_easy_setopt (_curl, CURLOPT_CAPATH, ca_path); - } - - if (ssl && (ca_info || ca_path)) { - curl_easy_setopt (_curl, CURLOPT_SSL_VERIFYPEER, 1); + if (ssl) { + ca_setopt (_curl); } } diff --git a/gtk2_ardour/ardour_http.h b/gtk2_ardour/ardour_http.h index 32215c8c4a..b4d8439549 100644 --- a/gtk2_ardour/ardour_http.h +++ b/gtk2_ardour/ardour_http.h @@ -26,7 +26,7 @@ namespace ArdourCurl { class HttpGet { - public: +public: HttpGet (bool persist = false, bool ssl = true); ~HttpGet (); @@ -75,7 +75,9 @@ class HttpGet { // called from fixup_bundle_environment static void setup_certificate_paths (); - private: + static void ca_setopt (CURL*); + +private: CURL* _curl; bool persist; @@ -94,8 +96,6 @@ class HttpGet { char* http_get (const char* url, int* status, bool with_error_logging); std::string http_get (const std::string& url, bool with_error_logging); - - } // namespace #endif /* __gtk_ardour_http_h__ */