diff --git a/src/frontend-common/http_downloader_winhttp.cpp b/src/frontend-common/http_downloader_winhttp.cpp index 634e3ab94..44356dd7f 100644 --- a/src/frontend-common/http_downloader_winhttp.cpp +++ b/src/frontend-common/http_downloader_winhttp.cpp @@ -3,6 +3,7 @@ #include "common/log.h" #include "common/string_util.h" #include "common/timer.h" +#include #include Log_SetChannel(HTTPDownloaderWinHttp); @@ -32,8 +33,12 @@ std::unique_ptr HTTPDownloader::Create() bool HTTPDownloaderWinHttp::Initialize() { - m_hSession = WinHttpOpen(StringUtil::UTF8StringToWideString(m_user_agent).c_str(), - WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY, nullptr, nullptr, WINHTTP_FLAG_ASYNC); + // WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY is not supported before Win8.1. + const DWORD dwAccessType = + IsWindows8Point1OrGreater() ? WINHTTP_ACCESS_TYPE_AUTOMATIC_PROXY : WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; + + m_hSession = WinHttpOpen(StringUtil::UTF8StringToWideString(m_user_agent).c_str(), dwAccessType, nullptr, nullptr, + WINHTTP_FLAG_ASYNC); if (m_hSession == NULL) { Log_ErrorPrintf("WinHttpOpen() failed: %u", GetLastError());