[net] fix an exception in DownloadFile()

* As per the MSDN, HttpOpenRequest's 6th parameter should be a NULL
  terminated list
This commit is contained in:
Pete Batard 2014-03-14 23:08:49 +00:00
parent 5c2d7aa21e
commit ac9ddca792
2 changed files with 8 additions and 7 deletions

View file

@ -246,6 +246,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
DWORD dwFlags, dwSize, dwDownloaded, dwTotalSize, dwStatus;
FILE* fd = NULL;
LONG progress_style;
const char* accept_types[] = {"*/*\0", NULL};
unsigned char buf[DOWNLOAD_BUFFER_SIZE];
char agent[64], hostname[64], urlpath[128];
HINTERNET hSession = NULL, hConnection = NULL, hRequest = NULL;
@ -304,7 +305,7 @@ DWORD DownloadFile(const char* url, const char* file, HWND hProgressDialog)
goto out;
}
hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, (const char**)"*/*\0",
hRequest = HttpOpenRequestA(hConnection, "GET", UrlParts.lpszUrlPath, NULL, NULL, accept_types,
INTERNET_FLAG_HYPERLINK|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP|INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS|INTERNET_FLAG_NO_COOKIES|
INTERNET_FLAG_NO_UI|INTERNET_FLAG_NO_CACHE_WRITE, (DWORD_PTR)NULL);
if (hRequest == NULL) {