You've already forked cpp-httplib
osx: fix inconsistent use of the macro TARGET_OS_OSX (#2222)
* osx: fix inconsistent use of the macro `TARGET_OS_OSX` Fixed the build error on iOS: ``` httplib.h:3583:3: error: unknown type name 'CFStringRef' 870 | CFStringRef hostname_ref = CFStringCreateWithCString( ``` Note, `TARGET_OS_OSX` is defined but is 0 when `TARGET_OS_IOS` is 1, and vise versa. Hence, `TARGET_OS_MAC` should have been used, that is set to 1 for the both targets. * improve: non-blocking getaddrinfo() for all mac target variants `TARGET_OS_MAC` should have been used, that is set to 1 for all other targets: OSX, IPHONE (IOS, TV, WATCH, VISION, BRIDGE), SIMULATOR, DRIVERKIT.
This commit is contained in:
12
httplib.h
12
httplib.h
@@ -308,7 +308,7 @@ using socket_t = int;
|
||||
|
||||
#if defined(CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO) || \
|
||||
defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||
#if TARGET_OS_OSX
|
||||
#if TARGET_OS_MAC
|
||||
#include <CFNetwork/CFHost.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
@@ -332,7 +332,7 @@ using socket_t = int;
|
||||
#endif // _WIN32
|
||||
|
||||
#if defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||
#if TARGET_OS_OSX
|
||||
#if TARGET_OS_MAC
|
||||
#include <Security/Security.h>
|
||||
#endif
|
||||
#endif // CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO
|
||||
@@ -3578,7 +3578,7 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
|
||||
}
|
||||
|
||||
return ret;
|
||||
#elif defined(TARGET_OS_OSX)
|
||||
#elif TARGET_OS_MAC
|
||||
// macOS implementation using CFHost API for asynchronous DNS resolution
|
||||
CFStringRef hostname_ref = CFStringCreateWithCString(
|
||||
kCFAllocatorDefault, node, kCFStringEncodingUTF8);
|
||||
@@ -6258,8 +6258,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
|
||||
|
||||
return result;
|
||||
}
|
||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && \
|
||||
defined(TARGET_OS_OSX)
|
||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && TARGET_OS_MAC
|
||||
template <typename T>
|
||||
using CFObjectPtr =
|
||||
std::unique_ptr<typename std::remove_pointer<T>::type, void (*)(CFTypeRef)>;
|
||||
@@ -11008,8 +11007,7 @@ inline bool SSLClient::load_certs() {
|
||||
#ifdef _WIN32
|
||||
loaded =
|
||||
detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_));
|
||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && \
|
||||
defined(TARGET_OS_OSX)
|
||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && TARGET_OS_MAC
|
||||
loaded = detail::load_system_certs_on_macos(SSL_CTX_get_cert_store(ctx_));
|
||||
#endif // _WIN32
|
||||
if (!loaded) { SSL_CTX_set_default_verify_paths(ctx_); }
|
||||
|
Reference in New Issue
Block a user