Skip to content

enable certificate revocation check with winhttp #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions Release/src/http/client/http_client_winhttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,17 +437,6 @@ class winhttp_client : public _http_client_communicator
}
}

#if 0 // Work in progress. Enable this to support server certificate revocation check
if( m_secure )
{
DWORD dwEnableSSLRevocOpt = WINHTTP_ENABLE_SSL_REVOCATION;
if(!WinHttpSetOption(m_hSession, WINHTTP_OPTION_ENABLE_FEATURE, &dwEnableSSLRevocOpt, sizeof(dwEnableSSLRevocOpt)))
{
DWORD dwError = GetLastError(); dwError;
return report_failure(U("Error enabling SSL revocation check"));
}
}
#endif
//Enable TLS 1.1 and 1.2
#if !defined(CPPREST_TARGET_XP)
BOOL win32_result(FALSE);
Expand Down Expand Up @@ -542,6 +531,18 @@ class winhttp_client : public _http_client_communicator
return;
}

// Enable the certificate revocation check
if (m_secure)
{
DWORD dwEnableSSLRevocOpt = WINHTTP_ENABLE_SSL_REVOCATION;
if (!WinHttpSetOption(winhttp_context->m_request_handle, WINHTTP_OPTION_ENABLE_FEATURE, &dwEnableSSLRevocOpt, sizeof(dwEnableSSLRevocOpt)))
{
auto errorCode = GetLastError();
request->report_error(errorCode, build_error_msg(errorCode, "Error enabling SSL revocation check"));
return;
}
}

if(proxy_info_required)
{
auto result = WinHttpSetOption(
Expand Down