winhttp: Return an error from winhttp_request_get_ResponseBody if the request is not sent.

This commit is contained in:
Hans Leidekker 2015-02-16 14:41:10 +01:00 committed by Alexandre Julliard
parent d6c9c984e5
commit 6f046e0f51
1 changed files with 5 additions and 0 deletions

View File

@ -3664,6 +3664,11 @@ static HRESULT WINAPI winhttp_request_get_ResponseBody(
if (!body) return E_INVALIDARG; if (!body) return E_INVALIDARG;
EnterCriticalSection( &request->cs ); EnterCriticalSection( &request->cs );
if (request->state < REQUEST_STATE_SENT)
{
err = ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND;
goto done;
}
if (!(sa = SafeArrayCreateVector( VT_UI1, 0, request->offset ))) if (!(sa = SafeArrayCreateVector( VT_UI1, 0, request->offset )))
{ {
err = ERROR_OUTOFMEMORY; err = ERROR_OUTOFMEMORY;