Skip to content

Commit

Permalink
Commit changes for build
Browse files Browse the repository at this point in the history
  • Loading branch information
atbagga committed Oct 28, 2021
1 parent 27ca4a3 commit e6f6e45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
8 changes: 3 additions & 5 deletions Release/src/http/client/http_client_winhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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(
Expand Down
23 changes: 5 additions & 18 deletions Release/src/http/client/x509_cert_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,19 @@ namespace client
{
namespace details
{
static bool verify_X509_cert_chain(const std::vector<std::string>& certChain, const std::string& hostName);
static bool verify_X509_cert_chain(
const std::vector<std::string>& 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 <type_traits>
#include <wincrypt.h>
#endif

#include <iomanip>

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);
Expand Down Expand Up @@ -480,21 +482,6 @@ std::vector<std::vector<unsigned char>> 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<const CERT_CONTEXT, cert_free_certificate_context> cert_context;
struct cert_free_certificate_chain
{
void operator()(const CERT_CHAIN_CONTEXT* chain) const { CertFreeCertificateChain(chain); }
};
typedef std::unique_ptr<const CERT_CHAIN_CONTEXT, cert_free_certificate_chain> chain_context;
} // namespace

static std::shared_ptr<certificate_info> build_certificate_info_ptr(const chain_context& chain,
const std::string& hostName,
bool isVerified)
Expand Down

0 comments on commit e6f6e45

Please sign in to comment.