Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
Set WinHttp to use TLS 1.1 or 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
cursey committed Jun 11, 2021
1 parent 7b161f5 commit 177f97f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Launcher/HttpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ HttpClient::HttpClient() {
if (m_session == nullptr) {
throw HttpError{this, GetLastError(), "Failed to start WinHTTP session"};
}

DWORD protocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;

if (WinHttpSetOption(m_session, WINHTTP_OPTION_SECURE_PROTOCOLS, &protocols, sizeof(protocols)) == FALSE) {
throw HttpError{this, GetLastError(), "Failed to set the WinHTTP session secure protocols"};
}
}

HttpClient::~HttpClient() {
Expand Down

0 comments on commit 177f97f

Please sign in to comment.