WinInet - file size retrieval is not working too hot
I have this little piece of code that gets file size of any http resource:
hConnect = InternetConnect(hInternet, ServerName, INTERNET_DEFAULT_HTTP_PORT, "", "", INTERNET_SERVICE_HTTP, 0, 0);
hReq = HttpOpenRequest(hConnect, "HEAD", ResourceName, NULL, "", (LPCSTR *) types, 0, 0);
HttpSendRequest(hReq, NULL, 0, NULL, 0);
HttpQueryInfo(hReq, HTTP_QUERY_CONTENT_LENGTH, buf, (LPDWORD)&s, 0);
And it works. Usually. Except on this one guy's computer, where HttpSendRequest returns with ERROR_HTTP_INVALID_SERVER_RESPONSE error.
Personally, I think antiviral software jumbles the request somehow (we are both in the same subnet, so network errors are unlikely), but it is not an excuse.
Does anyone have any ideas on how to make this code work? or a different approach maybe? My gratitude will be enormous =)