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++)
This commit is contained in:
Eduardo Arias 2024-04-23 13:00:19 -03:00
parent 91a736692a
commit ebf1f8fd28

View File

@ -20,10 +20,14 @@
#include <curl/curl.h>
#endif
#ifndef WIN32
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#else
#include <winsock2.h>
#endif
#include <string>
#include <fstream>
@ -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);