Skip to content

Commit a422105

Browse files
committed
Proper support for HTTPS in DownloadFile
Use secure connection right from the beginning.
1 parent 96423b8 commit a422105

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Src/Lib/DownloadHelper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ static TDownloadResult DownloadFile( const wchar_t *url, std::vector<char> &buf,
211211
int time=GetTickCount();
212212
if (pProgress)
213213
pProgress->SetText(LoadStringEx(IDS_PROGRESS_CONNECT));
214-
HINTERNET hConnect=InternetConnect(hInternet,host,INTERNET_DEFAULT_HTTP_PORT,L"",L"",INTERNET_SERVICE_HTTP,0,0);
214+
HINTERNET hConnect=InternetConnect(hInternet,host,components.nPort,L"",L"",INTERNET_SERVICE_HTTP,0,0);
215215
if (hConnect)
216216
{
217217
if (pProgress && pProgress->IsCanceled())
218218
res=DOWNLOAD_CANCEL;
219219
const wchar_t *accept[]={L"*/*",NULL};
220220
if (res==DOWNLOAD_OK)
221221
{
222-
HINTERNET hRequest=HttpOpenRequest(hConnect,L"GET",file,NULL,NULL,accept,bAcceptCached?0:INTERNET_FLAG_RELOAD,0);
222+
HINTERNET hRequest=HttpOpenRequest(hConnect,L"GET",file,NULL,NULL,accept,((components.nScheme==INTERNET_SCHEME_HTTPS)?INTERNET_FLAG_SECURE:0)|(bAcceptCached?0:INTERNET_FLAG_RELOAD),0);
223223
if (hRequest)
224224
{
225225
if (pProgress && pProgress->IsCanceled())

0 commit comments

Comments
 (0)