UI/updater: Enable HTTP2 and TLS 1.3

Unfortunately WinHTTP doesn't support multiplexing with HTTP2, but there
is still some minor benefit to enabling it. Windows 10 21H1 will enable
TLS 1.3 client support in Schannel, so let's get ready for it.
This commit is contained in:
Richard Stanway 2020-12-20 02:59:32 +01:00
parent 513e95d0f6
commit f0ed8c337e

View File

@ -339,7 +339,10 @@ static inline void CleanupPartialUpdates()
bool DownloadWorkerThread()
{
const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2;
const DWORD tlsProtocols = WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 |
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3;
const DWORD enableHTTP2Flag = WINHTTP_PROTOCOL_FLAG_HTTP2;
HttpHandle hSession = WinHttpOpen(L"OBS Studio Updater/2.1",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
@ -354,6 +357,9 @@ bool DownloadWorkerThread()
WinHttpSetOption(hSession, WINHTTP_OPTION_SECURE_PROTOCOLS,
(LPVOID)&tlsProtocols, sizeof(tlsProtocols));
WinHttpSetOption(hSession, WINHTTP_OPTION_ENABLE_HTTP_PROTOCOL,
(LPVOID)&enableHTTP2Flag, sizeof(enableHTTP2Flag));
HttpHandle hConnect = WinHttpConnect(hSession,
L"cdn-fastly.obsproject.com",
INTERNET_DEFAULT_HTTPS_PORT, 0);