urlmon: Fix timing issue with FLAG_REQUEST_COMPLETE and InternetQueryDataAvailable in HttpProtocol.
This commit is contained in:
parent
827644ad71
commit
9bcb9c16ec
|
@ -725,11 +725,14 @@ static HRESULT WINAPI HttpProtocol_Read(IInternetProtocol *iface, void *pv,
|
||||||
{
|
{
|
||||||
if (This->available_bytes == 0)
|
if (This->available_bytes == 0)
|
||||||
{
|
{
|
||||||
|
/* InternetQueryDataAvailable may immediately fork and perform its asynchronous
|
||||||
|
* read, so clear the flag _before_ calling so it does not incorrectly get cleared
|
||||||
|
* after the status callback is called */
|
||||||
|
This->flags &= ~FLAG_REQUEST_COMPLETE;
|
||||||
if (!InternetQueryDataAvailable(This->request, &This->available_bytes, 0, 0))
|
if (!InternetQueryDataAvailable(This->request, &This->available_bytes, 0, 0))
|
||||||
{
|
{
|
||||||
if (GetLastError() == ERROR_IO_PENDING)
|
if (GetLastError() == ERROR_IO_PENDING)
|
||||||
{
|
{
|
||||||
This->flags &= ~FLAG_REQUEST_COMPLETE;
|
|
||||||
hres = E_PENDING;
|
hres = E_PENDING;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -778,6 +781,9 @@ done:
|
||||||
if (pcbRead)
|
if (pcbRead)
|
||||||
*pcbRead = read;
|
*pcbRead = read;
|
||||||
|
|
||||||
|
if (hres != E_PENDING)
|
||||||
|
This->flags |= FLAG_REQUEST_COMPLETE;
|
||||||
|
|
||||||
return hres;
|
return hres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue