Skip to content

Commit

Permalink
Merge pull request #889 from libcpr/windows_no_revoke_fix
Browse files Browse the repository at this point in the history
Potential SSL Windows no revoke fix
  • Loading branch information
COM8 committed Mar 26, 2023
1 parent 1d9b4f8 commit 8f61ad4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cpr/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,22 @@ void Session::prepareCommon() {

#if LIBCURL_VERSION_MAJOR >= 7
#if LIBCURL_VERSION_MINOR >= 71
#if SUPPORT_SSL_NO_REVOKE
// NOLINTNEXTLINE (google-runtime-int)
long bitmask{0};
curl_easy_setopt(curl_->handle, CURLOPT_SSL_OPTIONS, &bitmask);
const bool noRevoke = bitmask & CURLSSLOPT_NO_REVOKE;
#endif

// Fix loading certs from Windows cert store when using OpenSSL:
curl_easy_setopt(curl_->handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA);

// Ensure SSL no revoke is still set
#if SUPPORT_SSL_NO_REVOKE
if (noRevoke) {
curl_easy_setopt(curl_->handle, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
}
#endif
#endif
#endif

Expand Down

0 comments on commit 8f61ad4

Please sign in to comment.