https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3261bbb7b95e60b9ce2d5…
commit 3261bbb7b95e60b9ce2d5dd23342a8b91659e6af
Author: Alexander Shaposhnikov <sanchaez(a)reactos.org>
AuthorDate: Mon Apr 2 23:51:35 2018 +0300
Commit: Alexander Shaposhnikov <sanchaez(a)reactos.org>
CommitDate: Mon Apr 2 23:55:05 2018 +0300
[RAPPS] Fix FTP downloads
---
base/applications/rapps/loaddlg.cpp | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp
index 5c8d6c217f..d8f659b219 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -719,15 +719,6 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
goto end;
}
- if (!HttpQueryInfoW(hFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
&dwStatus, &dwStatusLen, NULL))
- goto end;
-
- if (dwStatus != HTTP_STATUS_OK)
- {
- MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_DOWNLOAD);
- goto end;
- }
-
dwStatusLen = sizeof(dwStatus);
memset(&urlComponents, 0, sizeof(urlComponents));
@@ -745,10 +736,25 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
dwContentLen = 0;
if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || urlComponents.nScheme ==
INTERNET_SCHEME_HTTPS)
- HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
&dwContentLen, &dwStatusLen, 0);
+ {
+ // query connection
+ if (!HttpQueryInfoW(hFile, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
&dwStatus, &dwStatusLen, NULL))
+ goto end;
+
+ if (dwStatus != HTTP_STATUS_OK)
+ {
+ MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_DOWNLOAD);
+ goto end;
+ }
+
+ // query content length
+ HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER,
&dwContentLen, &dwStatusLen, NULL);
+ }
if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
+ {
dwContentLen = FtpGetFileSize(hFile, &dwStatus);
+ }
if (!dwContentLen)
{