13
0

Call curl_global_init() exactly only once (1/2)

This commit is contained in:
Robin Gareus 2017-08-31 19:33:51 +02:00
parent 720292696a
commit e544934780
3 changed files with 7 additions and 4 deletions

View File

@ -59,8 +59,6 @@ HttpGet::setup_certificate_paths ()
*/
assert (!ca_path && !ca_info); // call once
curl_global_init (CURL_GLOBAL_DEFAULT);
if (Glib::file_test ("/etc/pki/tls/certs/ca-bundle.crt", Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) {
// Fedora / RHEL, Arch
ca_info = "/etc/pki/tls/certs/ca-bundle.crt";

View File

@ -31,6 +31,8 @@
#include <fftw3.h>
#endif
#include <curl/curl.h>
#include "pbd/error.h"
#include "pbd/file_utils.h"
#include "pbd/textreceiver.h"
@ -288,6 +290,11 @@ int main (int argc, char *argv[])
{
ARDOUR::check_for_old_configuration_files();
/* global init is not thread safe.*/
if (curl_global_init (CURL_GLOBAL_DEFAULT)) {
cerr << "curl_global_init() failed. The web is gone. We're all doomed." << endl;
}
fixup_bundle_environment (argc, argv, localedir);
load_custom_fonts(); /* needs to happen before any gtk and pango init calls */

View File

@ -142,8 +142,6 @@ std::string Mootcher::sortMethodString(enum sortMethod sort)
//------------------------------------------------------------------------
void Mootcher::setcUrlOptions()
{
// basic init for curl
curl_global_init(CURL_GLOBAL_ALL);
// some servers don't like requests that are made without a user-agent field, so we provide one
curl_easy_setopt(curl, CURLOPT_USERAGENT, "libcurl-agent/1.0");
// setup curl error buffer