@@ -239,10 +239,13 @@ using socket_t = int;
239
239
#pragma comment(lib, "crypt32.lib")
240
240
#pragma comment(lib, "cryptui.lib")
241
241
#endif
242
- #elif defined(__APPLE__) // _WIN32
242
+ #elif defined(__APPLE__)
243
+ #include < TargetConditionals.h>
244
+ #if TARGET_OS_OSX
243
245
#include < CoreFoundation/CoreFoundation.h>
244
246
#include < Security/Security.h>
245
- #endif // __APPLE__
247
+ #endif // TARGET_OS_OSX
248
+ #endif // _WIN32
246
249
247
250
#include < openssl/err.h>
248
251
#include < openssl/evp.h>
@@ -4511,6 +4514,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
4511
4514
return result;
4512
4515
}
4513
4516
#elif defined(__APPLE__)
4517
+ #if TARGET_OS_OSX
4514
4518
template <typename T>
4515
4519
using CFObjectPtr =
4516
4520
std::unique_ptr<typename std::remove_pointer<T>::type, void (*)(CFTypeRef)>;
@@ -4585,7 +4589,7 @@ inline bool add_certs_to_x509_store(CFArrayRef certs, X509_STORE *store) {
4585
4589
return result;
4586
4590
}
4587
4591
4588
- inline bool load_system_certs_on_apple (X509_STORE *store) {
4592
+ inline bool load_system_certs_on_macos (X509_STORE *store) {
4589
4593
auto result = false ;
4590
4594
CFObjectPtr<CFArrayRef> certs (nullptr , cf_object_ptr_deleter);
4591
4595
if (retrieve_certs_from_keychain (certs) && certs) {
@@ -4598,8 +4602,9 @@ inline bool load_system_certs_on_apple(X509_STORE *store) {
4598
4602
4599
4603
return result;
4600
4604
}
4601
- #endif
4602
- #endif
4605
+ #endif // TARGET_OS_OSX
4606
+ #endif // _WIN32
4607
+ #endif // CPPHTTPLIB_OPENSSL_SUPPORT
4603
4608
4604
4609
#ifdef _WIN32
4605
4610
class WSInit {
@@ -8060,8 +8065,10 @@ inline bool SSLClient::load_certs() {
8060
8065
loaded =
8061
8066
detail::load_system_certs_on_windows (SSL_CTX_get_cert_store (ctx_));
8062
8067
#elif defined(__APPLE__)
8063
- loaded = detail::load_system_certs_on_apple (SSL_CTX_get_cert_store (ctx_));
8064
- #endif
8068
+ #if TARGET_OS_OSX
8069
+ loaded = detail::load_system_certs_on_macos (SSL_CTX_get_cert_store (ctx_));
8070
+ #endif // TARGET_OS_OSX
8071
+ #endif // _WIN32
8065
8072
if (!loaded) { SSL_CTX_set_default_verify_paths (ctx_); }
8066
8073
}
8067
8074
});
0 commit comments