From aa000ee58673027de243664f36f2c71eb32eca2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <> Date: Thu, 5 Feb 2026 21:31:30 -0500 Subject: [PATCH] http: cleanup --- src/http.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/http.cpp b/src/http.cpp index 79521d10..c822f60b 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -499,9 +499,9 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v ssl_socket_->asio_ssl_stream().set_verify_callback( [id = id_, logger = logger_, hostname, checkOcsp = checkOcsp_](bool preverified, asio::ssl::verify_context& ctx) -> bool { - X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); if (logger) { char subject_name[1024]; + X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle()); X509_NAME_oneline(X509_get_subject_name(cert), subject_name, 1024); logger->debug("[connection:{:d}] verify {:s} compliance to RFC 2818:\n{:s}", id, @@ -513,8 +513,13 @@ Connection::set_ssl_verification(const std::string& hostname, const asio::ssl::v auto verifier = asio::ssl::host_name_verification(hostname); bool verified = verifier(preverified, ctx); auto verify_ec = X509_STORE_CTX_get_error(ctx.native_handle()); - if (verify_ec != 0 /*X509_V_OK*/ and logger) - logger->error("[http::connection:{:d}] ssl verification error={:d} {}", id, verify_ec, verified); + if (verify_ec != 0 /*X509_V_OK*/ and logger) { + logger->error("[http::connection:{:d}] ssl verification error {:d}: {}. verified: {}", + id, + verify_ec, + X509_verify_cert_error_string(verify_ec), + verified); + } if (verified and checkOcsp) { std::unique_ptr chain(X509_STORE_CTX_get1_chain( ctx.native_handle()),