mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 22:35:39 +00:00
HTTPDownloaderWinHttp: Hopefully fix issue on Windows <8.1
This commit is contained in:
parent
429ab9ffa2
commit
a8fd4d5bbd
|
@ -3,6 +3,7 @@
|
|||
#include "common/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "common/timer.h"
|
||||
#include <VersionHelpers.h>
|
||||
#include <algorithm>
|
||||
Log_SetChannel(HTTPDownloaderWinHttp);
|
||||
|
||||
|
@ -32,8 +33,12 @@ std::unique_ptr<HTTPDownloader> 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());
|
||||
|
|
Loading…
Reference in a new issue