Skip to content

Conversation

JakubHazik
Copy link

@JakubHazik JakubHazik commented Aug 22, 2025

Try resolve #2217
Transmit X509_STORE between SSLClient-s during redirect.
Make variable ca_cert_store_ reusable between multiple clients

@yhirose
Copy link
Owner

yhirose commented Aug 22, 2025

@JakubHazik thanks for the pull request. Could you take a look at the GitHub Actions workflow failures and compiler warnings? (You don't need to worry about the abidiff/adi check.)

@@ -1546,7 +1546,7 @@ class ClientImpl {
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
void set_ca_cert_path(const std::string &ca_cert_file_path,
const std::string &ca_cert_dir_path = std::string());
void set_ca_cert_store(X509_STORE *ca_cert_store);
virtual void set_ca_cert_store(X509_STORE *ca_cert_store);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove virtual. It's not necessary.

@@ -11857,7 +11860,7 @@ inline void Client::set_ca_cert_path(const std::string &ca_cert_file_path,

inline void Client::set_ca_cert_store(X509_STORE *ca_cert_store) {
if (is_ssl_) {
static_cast<SSLClient &>(*cli_).set_ca_cert_store(ca_cert_store);
dynamic_cast<SSLClient &>(*cli_).set_ca_cert_store(ca_cert_store);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please revert it to static_cast?

@@ -11869,13 +11872,13 @@ inline void Client::load_ca_cert_store(const char *ca_cert, std::size_t size) {

inline long Client::get_openssl_verify_result() const {
if (is_ssl_) {
return static_cast<SSLClient &>(*cli_).get_openssl_verify_result();
return dynamic_cast<SSLClient &>(*cli_).get_openssl_verify_result();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please revert it to static_cast, too?

}
return -1; // NOTE: -1 doesn't match any of X509_V_ERR_???
}

inline SSL_CTX *Client::ssl_context() const {
if (is_ssl_) { return static_cast<SSLClient &>(*cli_).ssl_context(); }
if (is_ssl_) { return dynamic_cast<SSLClient &>(*cli_).ssl_context(); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please revert it to static_cast, too?

@yhirose
Copy link
Owner

yhirose commented Aug 26, 2025

@JakubHazik I made come comments. After the adjustments are made, could you please run clang-format, so that test/stle-check runs successfully? Thanks!

@yhirose
Copy link
Owner

yhirose commented Aug 29, 2025

I made the adjustments for you at eb5a65e. :)

@yhirose yhirose closed this Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SSL verification failure on redirect
2 participants