I'm trying to download a file from a server using WinHttpSendRequest but the result is 0 and error code is 87 (ERROR_INVALID_PARAMETER).
// Specify an HTTP server.
if (hSession)
hConnect = WinHttpConnect( hSession, T2W((LPTSTR)tsDownloadServer.c_str()), wPort, 0 );
// tsDownloadServer = "xxx.xxx.xxx.xx:xxxx"
// Create an HTTP request handle.
if (hConnect)
hRequest = WinHttpOpenRequest( hConnect, L"GET",T2W((LPTSTR)tsDownloadFileURLPath.c_str()), NULL, WINHTTP_NO_REFERER, ppwszAcceptTypes, dwOpenRequestFlag );
// tsDownloadFileURLPath = "/xxxxx/xxxxxxxx/58bbf9067ad35634c7caa5594e8ec712/windows_installer/xxxxx_xxxxxx.wak"
bResults = WinHttpSendRequest( hRequest, WINHTTP_NO_ADDITIONAL_HEADERS, 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0 );
bResults is 0 and GetLastError() return 87
I researched on the internet about the related issue is due to exceed 24 bytes data however in my case, I set WINHTTP_NO_REQUEST_DATA in the parameter.
How can I send a request to the server?
Aucun commentaire:
Enregistrer un commentaire