Skip to content

Commit d883eab

Browse files
authored
Merge pull request microsoft#516 from xqp/feature/enable-certificate-revocation-pr
enable certificate revocation check with winhttp
2 parents 186717f + 90ab8f7 commit d883eab

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Release/src/http/client/http_client_winhttp.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,6 @@ class winhttp_client : public _http_client_communicator
455455
}
456456
}
457457

458-
#if 0 // Work in progress. Enable this to support server certificate revocation check
459-
if( m_secure )
460-
{
461-
DWORD dwEnableSSLRevocOpt = WINHTTP_ENABLE_SSL_REVOCATION;
462-
if(!WinHttpSetOption(m_hSession, WINHTTP_OPTION_ENABLE_FEATURE, &dwEnableSSLRevocOpt, sizeof(dwEnableSSLRevocOpt)))
463-
{
464-
DWORD dwError = GetLastError(); dwError;
465-
return report_failure(U("Error enabling SSL revocation check"));
466-
}
467-
}
468-
#endif
469458
//Enable TLS 1.1 and 1.2
470459
#if !defined(CPPREST_TARGET_XP)
471460
BOOL win32_result(FALSE);
@@ -559,6 +548,18 @@ class winhttp_client : public _http_client_communicator
559548
return;
560549
}
561550

551+
// Enable the certificate revocation check
552+
if (m_secure)
553+
{
554+
DWORD dwEnableSSLRevocOpt = WINHTTP_ENABLE_SSL_REVOCATION;
555+
if (!WinHttpSetOption(winhttp_context->m_request_handle, WINHTTP_OPTION_ENABLE_FEATURE, &dwEnableSSLRevocOpt, sizeof(dwEnableSSLRevocOpt)))
556+
{
557+
auto errorCode = GetLastError();
558+
request->report_error(errorCode, build_error_msg(errorCode, "Error enabling SSL revocation check"));
559+
return;
560+
}
561+
}
562+
562563
if(proxy_info_required)
563564
{
564565
auto result = WinHttpSetOption(

0 commit comments

Comments
 (0)