Skip to content

Commit

Permalink
Fixed missing SUPPORT_CURLOPT_SSL_CTX_FUNCTION handling
Browse files Browse the repository at this point in the history
  • Loading branch information
COM8 committed Sep 28, 2024
1 parent 59ddfd0 commit f44c424
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpr/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions include/cpr/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ class Session : public std::enable_shared_from_this<Session> {
* 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_;
Expand Down
2 changes: 2 additions & 0 deletions include/cpr/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T = ProgressCallback>
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) {
Expand Down

0 comments on commit f44c424

Please sign in to comment.