Is it possible for GetLastError() to return ERROR_WINHTTP_RESEND_REQUEST after calling WinHttpSendRequest?
Documentation for WinHttpSendRequest:
ERROR_WINHTTP_RESEND_REQUEST
The application must call WinHttpSendRequest again due to a redirect or authentication challenge. Windows Server 2003 with SP1, Windows XP with SP2 and Windows 2000: This error is not supported.
But samples from MSDN (Authentication in WinHTTP) checks for this value after WinHttpReceiveResponse.
At a first glance the sample may look like that. But if you look closely, the sample actually checks for
ERROR_WINHTTP_RESEND_REQUESTif eitherWinHttpSendRequest()orWinHttpReceiveResponse()fails:If
WinHttpSendRequest()returnsFALSE, the call toWinHttpReceiveResponse()will be skipped andGetLastError()will be checked forERROR_WINHTTP_RESEND_REQUEST. This code is inside awhileloop, so thecontinuestatement will cause the remaining portion of the loop to be skipped soWinHttpSendRequest()will be called again.Conclusion: The sample is in line with the reference documentation.