mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-10 09:43:51 +00:00
Fix #504
This commit is contained in:
parent
d8612ac02d
commit
d9fe3fa020
24
httplib.h
24
httplib.h
@ -1321,28 +1321,38 @@ public:
|
|||||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||||
Client2 &set_ca_cert_path(const char *ca_cert_file_path,
|
Client2 &set_ca_cert_path(const char *ca_cert_file_path,
|
||||||
const char *ca_cert_dir_path = nullptr) {
|
const char *ca_cert_dir_path = nullptr) {
|
||||||
dynamic_cast<SSLClient &>(*cli_).set_ca_cert_path(ca_cert_file_path,
|
if (is_ssl_) {
|
||||||
ca_cert_dir_path);
|
static_cast<SSLClient &>(*cli_).set_ca_cert_path(ca_cert_file_path,
|
||||||
|
ca_cert_dir_path);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client2 &set_ca_cert_store(X509_STORE *ca_cert_store) {
|
Client2 &set_ca_cert_store(X509_STORE *ca_cert_store) {
|
||||||
dynamic_cast<SSLClient &>(*cli_).set_ca_cert_store(ca_cert_store);
|
if (is_ssl_) {
|
||||||
|
static_cast<SSLClient &>(*cli_).set_ca_cert_store(ca_cert_store);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Client2 &enable_server_certificate_verification(bool enabled) {
|
Client2 &enable_server_certificate_verification(bool enabled) {
|
||||||
dynamic_cast<SSLClient &>(*cli_).enable_server_certificate_verification(
|
if (is_ssl_) {
|
||||||
enabled);
|
static_cast<SSLClient &>(*cli_).enable_server_certificate_verification(
|
||||||
|
enabled);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
long get_openssl_verify_result() const {
|
long get_openssl_verify_result() const {
|
||||||
return dynamic_cast<SSLClient &>(*cli_).get_openssl_verify_result();
|
if (is_ssl_) {
|
||||||
|
return static_cast<SSLClient &>(*cli_).get_openssl_verify_result();
|
||||||
|
}
|
||||||
|
return -1; // NOTE: -1 doesn't match any of X509_V_ERR_???
|
||||||
}
|
}
|
||||||
|
|
||||||
SSL_CTX *ssl_context() const {
|
SSL_CTX *ssl_context() const {
|
||||||
return dynamic_cast<SSLClient &>(*cli_).ssl_context();
|
if (is_ssl_) { return static_cast<SSLClient &>(*cli_).ssl_context(); }
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user