From c439a10cfec123470fcf5a5a31c8eae36c56ae2d Mon Sep 17 00:00:00 2001 From: Nimetu Date: Mon, 3 Jun 2019 20:55:39 +0300 Subject: [PATCH] Fixed: WebIG notif thread did not have curl certificates loaded. --HG-- branch : develop --- .../src/interface_v3/group_html_webig.cpp | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.cpp b/code/ryzom/client/src/interface_v3/group_html_webig.cpp index c7ee1a6c3..8f5c6da01 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -30,6 +30,7 @@ #include "../connection.h" #include +#include "nel/gui/curl_certificates.h" using namespace std; using namespace NLMISC; @@ -168,6 +169,17 @@ public: _Thread = NULL; curl_global_init(CURL_GLOBAL_ALL); + Curl = NULL; + //nlinfo("ctor CWebigNotificationThread"); + } + + void init() + { + if (Curl) + { + return; + } + Curl = curl_easy_init(); if(!Curl) return; curl_easy_setopt(Curl, CURLOPT_COOKIEFILE, ""); @@ -175,7 +187,8 @@ public: curl_easy_setopt(Curl, CURLOPT_USERAGENT, getUserAgent().c_str()); curl_easy_setopt(Curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(Curl, CURLOPT_WRITEFUNCTION, writeDataFromCurl); - //nlinfo("ctor CWebigNotificationThread"); + + NLGUI::CCurlCertificates::useCertificates(Curl); } ~CWebigNotificationThread() @@ -183,7 +196,7 @@ public: if(Curl) { curl_easy_cleanup(Curl); - Curl = 0; + Curl = NULL; } if (_Thread) { @@ -275,6 +288,9 @@ public: void startThread() { + // initialize curl outside thread + init(); + if (!_Thread) { _Thread = IThread::create(this); @@ -286,7 +302,6 @@ public: { nlwarning("WebIgNotification thread already started"); } - } void stopThread() @@ -305,7 +320,7 @@ public: } } - bool isRunning() const + bool isRunning() const { return _Running; }