UI/updater: Use TLS 1.2 with WinHTTP

On Windows 7, WinHTTP defaults to using only SSL3 and TLS 1.0. The
obsproject.com server was updated to remove TLS 1.0 support and
this has caused updates to stop working on Windows 7.
This commit is contained in:
Richard Stanway 2017-10-02 14:01:22 +02:00
parent 27d16f961b
commit 05fb67717e
No known key found for this signature in database
GPG Key ID: AAC1E5265D71B3FD
2 changed files with 11 additions and 1 deletions

View File

@ -88,6 +88,8 @@ bool HTTPPostData(const wchar_t *url,
const wchar_t *acceptTypes[] = {L"*/*", nullptr};
const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
responseBuf.clear();
/* -------------------------------------- *
@ -109,7 +111,7 @@ bool HTTPPostData(const wchar_t *url,
/* -------------------------------------- *
* connect to server */
hSession = WinHttpOpen(L"OBS Updater/2.1",
hSession = WinHttpOpen(L"OBS Studio Updater/2.1",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS,
@ -119,6 +121,9 @@ bool HTTPPostData(const wchar_t *url,
return false;
}
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
hConnect = WinHttpConnect(hSession, hostName,
secure
? INTERNET_DEFAULT_HTTPS_PORT

View File

@ -344,6 +344,8 @@ static inline void CleanupPartialUpdates()
bool DownloadWorkerThread()
{
const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
HttpHandle hSession = WinHttpOpen(L"OBS Studio Updater/2.1",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
@ -355,6 +357,9 @@ bool DownloadWorkerThread()
return false;
}
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
HttpHandle hConnect = WinHttpConnect(hSession, L"obsproject.com",
INTERNET_DEFAULT_HTTPS_PORT, 0);
if (!hConnect) {