From ebf1f8fd28251fd6bd205e510421c46d2eee9269 Mon Sep 17 00:00:00 2001 From: Eduardo Arias Date: Tue, 23 Apr 2024 13:00:19 -0300 Subject: [PATCH] On Windows use the operating system's native CA store for certificate verification of https requests. - Updated included headers to support compilation on Windows (using Visual C++) --- src/utils/https_client.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/https_client.cc b/src/utils/https_client.cc index 9ee84b15..66e818d4 100644 --- a/src/utils/https_client.cc +++ b/src/utils/https_client.cc @@ -20,10 +20,14 @@ #include #endif +#ifndef WIN32 #include #include #include #include +#else +#include +#endif #include #include @@ -94,6 +98,11 @@ bool HttpsClient::download(const std::string &uri) { curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1); +#ifdef WIN32 + /* use the operating system's native CA store for certificate verification.*/ + curl_easy_setopt(curl, CURLOPT_SSL_OPTIONS, (long)CURLSSLOPT_NATIVE_CA); +#endif + /* send all data to this function */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &HttpsClient::handle);