From f44c4244b80871e9deb1d7e9103de28d0a6c202f Mon Sep 17 00:00:00 2001 From: Fabian Sauter Date: Sat, 28 Sep 2024 05:34:39 +0100 Subject: [PATCH] Fixed missing SUPPORT_CURLOPT_SSL_CTX_FUNCTION handling --- cpr/util.cpp | 2 ++ include/cpr/session.h | 2 ++ include/cpr/util.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/cpr/util.cpp b/cpr/util.cpp index dc02a339e..9a1ba44d7 100644 --- a/cpr/util.cpp +++ b/cpr/util.cpp @@ -156,9 +156,11 @@ int debugUserFunction(CURL* /*handle*/, curl_infotype type, char* data, size_t s return 0; } +#if SUPPORT_CURLOPT_SSL_CTX_FUNCTION CURLcode sslCtxUserFunction(CURL* curl, void* sslctx, const ssl::SslCtxCallback* ctx) { return (*ctx)(curl, sslctx); } +#endif /** * Creates a temporary CurlHolder object and uses it to escape the given string. diff --git a/include/cpr/session.h b/include/cpr/session.h index 24e3f8dea..ae9850b34 100644 --- a/include/cpr/session.h +++ b/include/cpr/session.h @@ -249,7 +249,9 @@ class Session : public std::enable_shared_from_this { * Ensures that the "Transfer-Encoding" is set to "chunked", if not overriden in header_. **/ ReadCallback readcb_; + #if SUPPORT_CURLOPT_SSL_CTX_FUNCTION ssl::SslCtxCallback sslctxcb_; + #endif HeaderCallback headercb_; WriteCallback writecb_; ProgressCallback progresscb_; diff --git a/include/cpr/util.h b/include/cpr/util.h index 355482f73..5a867d29c 100644 --- a/include/cpr/util.h +++ b/include/cpr/util.h @@ -19,7 +19,9 @@ size_t headerUserFunction(char* ptr, size_t size, size_t nmemb, const HeaderCall size_t writeFunction(char* ptr, size_t size, size_t nmemb, std::string* data); size_t writeFileFunction(char* ptr, size_t size, size_t nmemb, std::ofstream* file); size_t writeUserFunction(char* ptr, size_t size, size_t nmemb, const WriteCallback* write); +#if SUPPORT_CURLOPT_SSL_CTX_FUNCTION CURLcode sslCtxUserFunction(CURL* curl, void* sslctx, const ssl::SslCtxCallback* ctx); +#endif template int progressUserFunction(const T* progress, cpr_pf_arg_t dltotal, cpr_pf_arg_t dlnow, cpr_pf_arg_t ultotal, cpr_pf_arg_t ulnow) {