Jelajahi Sumber

Refactor OpenSSL support: streamline CA certificate store management

yhirose 2 minggu lalu
induk
melakukan
623f47eacc
1 mengubah file dengan 1 tambahan dan 13 penghapusan
  1. 1 13
      httplib.h

+ 1 - 13
httplib.h

@@ -1756,9 +1756,6 @@ public:
 #ifdef CPPHTTPLIB_OPENSSL_SUPPORT
   void set_ca_cert_store(X509_STORE *ca_cert_store);
   X509_STORE *create_ca_cert_store(const char *ca_cert, std::size_t size) const;
-#endif
-
-#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
   void set_server_certificate_verifier(
       std::function<SSLVerifierResponse(SSL *ssl)> verifier);
 #endif
@@ -1879,10 +1876,6 @@ protected:
   std::string ca_cert_dir_path_;
 #endif
 
-#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
-  X509_STORE *ca_cert_store_ = nullptr;
-#endif
-
 #ifdef CPPHTTPLIB_SSL_ENABLED
   bool server_certificate_verification_ = true;
   bool server_hostname_verification_ = true;
@@ -1890,6 +1883,7 @@ protected:
 #endif
 
 #ifdef CPPHTTPLIB_OPENSSL_SUPPORT
+  X509_STORE *ca_cert_store_ = nullptr;
   std::function<SSLVerifierResponse(SSL *ssl)> server_certificate_verifier_;
 #endif
 
@@ -2158,9 +2152,7 @@ public:
 #ifdef CPPHTTPLIB_SSL_ENABLED
   void set_ca_cert_path(const std::string &ca_cert_file_path,
                         const std::string &ca_cert_dir_path = std::string());
-#endif
 
-#ifdef CPPHTTPLIB_SSL_ENABLED
   // Use void* directly since tls::tls_ca_store_t is not yet defined here
   void set_ca_cert_store(void *ca_cert_store);
   void load_ca_cert_store(const char *ca_cert, std::size_t size);
@@ -14409,14 +14401,10 @@ inline std::string hash(HashAlgorithm algo, const std::string &data) {
 }
 
 } // namespace crypto
-} // namespace detail
-#endif // CPPHTTPLIB_MBEDTLS_SUPPORT
 
 /*
  * Mbed TLS TLS Abstraction Layer Implementation
  */
-#ifdef CPPHTTPLIB_MBEDTLS_SUPPORT
-namespace detail {
 namespace tls {
 
 // Mbed TLS context wrapper (holds config, entropy, DRBG, CA chain, own