You've already forked cpp-httplib
Fix warnings
This commit is contained in:
28
httplib.h
28
httplib.h
@ -249,6 +249,10 @@ using socket_t = int;
|
|||||||
#endif
|
#endif
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#include <TargetConditionals.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@ -278,15 +282,12 @@ using socket_t = int;
|
|||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#if defined(CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO)
|
#if defined(CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO) || defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||||
#if defined(__APPLE__)
|
|
||||||
#include <TargetConditionals.h>
|
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
#include <CFNetwork/CFHost.h>
|
#include <CFNetwork/CFHost.h>
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif // CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO or CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN
|
||||||
#endif // CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO
|
|
||||||
|
|
||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -304,15 +305,10 @@ using socket_t = int;
|
|||||||
#endif
|
#endif
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#if defined(CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO)
|
#if defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN)
|
||||||
#if defined(__APPLE__)
|
|
||||||
#include <TargetConditionals.h>
|
|
||||||
#if TARGET_OS_OSX
|
#if TARGET_OS_OSX
|
||||||
#include <CFNetwork/CFHost.h>
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
|
||||||
#include <Security/Security.h>
|
#include <Security/Security.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif // CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO
|
#endif // CPPHTTPLIB_USE_NON_BLOCKING_GETADDRINFO
|
||||||
|
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
@ -3444,7 +3440,7 @@ inline int getaddrinfo_with_timeout(const char *node, const char *service,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(TARGET_OS_OSX)
|
||||||
// macOS implementation using CFHost API for asynchronous DNS resolution
|
// macOS implementation using CFHost API for asynchronous DNS resolution
|
||||||
CFStringRef hostname_ref = CFStringCreateWithCString(
|
CFStringRef hostname_ref = CFStringCreateWithCString(
|
||||||
kCFAllocatorDefault, node, kCFStringEncodingUTF8);
|
kCFAllocatorDefault, node, kCFStringEncodingUTF8);
|
||||||
@ -6026,8 +6022,7 @@ inline bool load_system_certs_on_windows(X509_STORE *store) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(__APPLE__)
|
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(TARGET_OS_OSX)
|
||||||
#if TARGET_OS_OSX
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using CFObjectPtr =
|
using CFObjectPtr =
|
||||||
std::unique_ptr<typename std::remove_pointer<T>::type, void (*)(CFTypeRef)>;
|
std::unique_ptr<typename std::remove_pointer<T>::type, void (*)(CFTypeRef)>;
|
||||||
@ -6115,7 +6110,6 @@ inline bool load_system_certs_on_macos(X509_STORE *store) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif // TARGET_OS_OSX
|
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#endif // CPPHTTPLIB_OPENSSL_SUPPORT
|
#endif // CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
|
|
||||||
@ -10223,10 +10217,8 @@ inline bool SSLClient::load_certs() {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
loaded =
|
loaded =
|
||||||
detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_));
|
detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_));
|
||||||
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(__APPLE__)
|
#elif defined(CPPHTTPLIB_USE_CERTS_FROM_MACOSX_KEYCHAIN) && defined(TARGET_OS_OSX)
|
||||||
#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
|
#endif // _WIN32
|
||||||
if (!loaded) { SSL_CTX_set_default_verify_paths(ctx_); }
|
if (!loaded) { SSL_CTX_set_default_verify_paths(ctx_); }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user