urlmon: Fix HttpProtocol behavior when InternetQueryDataAvailable returns ERROR_IO_PENDING.
This commit is contained in:
parent
4e0371f322
commit
fc48d6da73
|
@ -68,11 +68,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
|||
* Continue is executed by the protocol sink.
|
||||
*/
|
||||
#define FLAG_REQUEST_COMPLETE 0x1
|
||||
#define FLAG_FIRST_DATA_REPORTED 0x2
|
||||
#define FLAG_ALL_DATA_READ 0x4
|
||||
#define FLAG_LAST_DATA_REPORTED 0x8
|
||||
#define FLAG_RESULT_REPORTED 0x10
|
||||
#define FLAG_CALLED_SWITCH 0x20
|
||||
#define FLAG_CALLED_SWITCH 0x2
|
||||
#define FLAG_FIRST_CONTINUE_COMPLETE 0x4
|
||||
#define FLAG_FIRST_DATA_REPORTED 0x8
|
||||
#define FLAG_ALL_DATA_READ 0x10
|
||||
#define FLAG_LAST_DATA_REPORTED 0x20
|
||||
#define FLAG_RESULT_REPORTED 0x40
|
||||
|
||||
typedef struct {
|
||||
const IInternetProtocolVtbl *lpInternetProtocolVtbl;
|
||||
|
@ -180,20 +181,15 @@ static void CALLBACK HTTPPROTOCOL_InternetStatusCallback(
|
|||
case INTERNET_STATUS_REQUEST_COMPLETE:
|
||||
if (This->flags & FLAG_CALLED_SWITCH)
|
||||
return;
|
||||
This->flags |= FLAG_CALLED_SWITCH;
|
||||
This->flags |= FLAG_CALLED_SWITCH | FLAG_REQUEST_COMPLETE;
|
||||
|
||||
/* PROTOCOLDATA same as native */
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.dwState = 0xf1000000;
|
||||
if (!(This->flags & FLAG_REQUEST_COMPLETE))
|
||||
{
|
||||
This->flags |= FLAG_REQUEST_COMPLETE;
|
||||
data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (This->flags & FLAG_FIRST_CONTINUE_COMPLETE)
|
||||
data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS;
|
||||
}
|
||||
else
|
||||
data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA;
|
||||
IInternetProtocolSink_Switch(This->protocol_sink, &data);
|
||||
return;
|
||||
default:
|
||||
|
@ -583,15 +579,24 @@ static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDA
|
|||
{
|
||||
This->content_length = atoiW(content_length);
|
||||
}
|
||||
|
||||
This->flags |= FLAG_FIRST_CONTINUE_COMPLETE;
|
||||
}
|
||||
|
||||
if (pProtocolData->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA)
|
||||
{
|
||||
if (!InternetQueryDataAvailable(This->request, &This->available_bytes, 0, 0))
|
||||
{
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
This->flags &= ~FLAG_REQUEST_COMPLETE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN("InternetQueryDataAvailable failed: %d\n", GetLastError());
|
||||
HTTPPROTOCOL_ReportResult(This, INET_E_DATA_NOT_AVAILABLE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
HTTPPROTOCOL_ReportData(This);
|
||||
|
@ -658,6 +663,7 @@ static HRESULT WINAPI HttpProtocol_Read(IInternetProtocol *iface, void *pv,
|
|||
{
|
||||
if (GetLastError() == ERROR_IO_PENDING)
|
||||
{
|
||||
This->flags &= ~FLAG_REQUEST_COMPLETE;
|
||||
hres = E_PENDING;
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue