The answers are the following:
- No. One connection may perform a bunch of requests.
This is the draft of the code:
hSession = WinHttpOpen( L"Agent/1.0",.. hConnect = WinHttpConnect(hSession,.. for (all_files_to_upload) { hRequest = WinHttpOpenRequest( hConnect, L"PUT",.. WinHttpSetCredentials(hRequest,.. WinHttpAddRequestHeaders( hRequest,.. WinHttpSendRequest( hRequest,.. WinHttpWriteData(hRequest,.. WinHttpReceiveResponse(hRequest,.. WinHttpQueryHeaders(hRequest,.. WinHttpCloseHandle(hRequest); } if (hConnect) WinHttpCloseHandle(hConnect); if (hSession) WinHttpCloseHandle(hSession);