Co-authored-by: Sergey Kazmin <sergey.kazmin@kaspersky.com>
This commit is contained in:
Sergey Kazmin 2023-04-04 17:12:15 +03:00 committed by GitHub
parent ff34749572
commit e62a4b02e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View file

@ -239,7 +239,7 @@ using socket_t = int;
#pragma comment(lib, "crypt32.lib")
#pragma comment(lib, "cryptui.lib")
#endif
#elif defined(__APPLE__)
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(__APPLE__)
#include <TargetConditionals.h>
#if TARGET_OS_OSX
#include <CoreFoundation/CoreFoundation.h>
@ -2668,7 +2668,7 @@ socket_t create_socket(const std::string &host, const std::string &ip, int port,
auto sock = socket(hints.ai_family, hints.ai_socktype, hints.ai_protocol);
if (sock != INVALID_SOCKET) {
sockaddr_un addr {};
sockaddr_un addr{};
addr.sun_family = AF_UNIX;
std::copy(host.begin(), host.end(), addr.sun_path);
@ -4513,7 +4513,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
return result;
}
#elif defined(__APPLE__)
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(__APPLE__)
#if TARGET_OS_OSX
template <typename T>
using CFObjectPtr =
@ -8064,9 +8064,9 @@ inline bool SSLClient::load_certs() {
#ifdef _WIN32
loaded =
detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_));
#elif defined(__APPLE__)
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(__APPLE__)
#if TARGET_OS_OSX
loaded = detail::load_system_certs_on_macos(SSL_CTX_get_cert_store(ctx_));
loaded = detail::load_system_certs_on_macos(SSL_CTX_get_cert_store(ctx_));
#endif // TARGET_OS_OSX
#endif // _WIN32
if (!loaded) { SSL_CTX_set_default_verify_paths(ctx_); }