diff --git a/Release/src/http/client/http_client_winhttp.cpp b/Release/src/http/client/http_client_winhttp.cpp index f2e449d1ed..28e51ea3b2 100644 --- a/Release/src/http/client/http_client_winhttp.cpp +++ b/Release/src/http/client/http_client_winhttp.cpp @@ -2010,6 +2010,9 @@ class winhttp_client final : public _http_client_communicator } case WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: { + // Todo Check where to put this. atbagga + p_request_context->on_send_request_validate_cn(); + // get actual URL which might be different from the original one due to redirection etc. DWORD urlSize {0}; WinHttpQueryOption(hRequestHandle, WINHTTP_OPTION_URL, NULL, &urlSize); @@ -2163,11 +2166,6 @@ class winhttp_client final : public _http_client_communicator } return; } - case WINHTTP_CALLBACK_STATUS_SENDING_REQUEST: - { - p_request_context->on_send_request_validate_cn(); - return; - } case WINHTTP_CALLBACK_STATUS_SECURE_FAILURE: { p_request_context->report_exception(web::http::http_exception( diff --git a/Release/src/http/client/x509_cert_utilities.cpp b/Release/src/http/client/x509_cert_utilities.cpp index 4e9ae6bb0d..d1af9284bd 100644 --- a/Release/src/http/client/x509_cert_utilities.cpp +++ b/Release/src/http/client/x509_cert_utilities.cpp @@ -41,9 +41,11 @@ namespace client { namespace details { -static bool verify_X509_cert_chain(const std::vector& certChain, const std::string& hostName); +static bool verify_X509_cert_chain( + const std::vector& certChain, + const std::string& hostName, + const CertificateChainFunction& certInfoFunc); -bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context& verifyCtx, const std::string& hostName) #if defined(_WIN32) #include #include @@ -51,7 +53,7 @@ bool verify_cert_chain_platform_specific(boost::asio::ssl::verify_context& verif #include - bool is_end_certificate_in_chain(boost::asio::ssl::verify_context& verifyCtx) +bool is_end_certificate_in_chain(boost::asio::ssl::verify_context& verifyCtx) { X509_STORE_CTX* storeContext = verifyCtx.native_handle(); int currentDepth = X509_STORE_CTX_get_error_depth(storeContext); @@ -480,21 +482,6 @@ std::vector> get_X509_cert_chain_encoded_data(boost:: } #if defined(_WIN32) -namespace -{ -// Helper RAII unique_ptrs to free Windows structures. -struct cert_free_certificate_context -{ - void operator()(const CERT_CONTEXT* ctx) const { CertFreeCertificateContext(ctx); } -}; -typedef std::unique_ptr cert_context; -struct cert_free_certificate_chain -{ - void operator()(const CERT_CHAIN_CONTEXT* chain) const { CertFreeCertificateChain(chain); } -}; -typedef std::unique_ptr chain_context; -} // namespace - static std::shared_ptr build_certificate_info_ptr(const chain_context& chain, const std::string& hostName, bool isVerified)