Module: wine Branch: master Commit: 9bcb9c16ec8394f3dbae1a553378bb935bf46e20 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9bcb9c16ec8394f3dbae1a5533...
Author: Misha Koshelev mk144210@bcm.edu Date: Mon Jul 23 20:29:55 2007 -0500
urlmon: Fix timing issue with FLAG_REQUEST_COMPLETE and InternetQueryDataAvailable in HttpProtocol.
---
dlls/urlmon/http.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c index 2afe267..a720651 100644 --- a/dlls/urlmon/http.c +++ b/dlls/urlmon/http.c @@ -725,11 +725,14 @@ static HRESULT WINAPI HttpProtocol_Read(IInternetProtocol *iface, void *pv, { 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 (GetLastError() == ERROR_IO_PENDING) { - This->flags &= ~FLAG_REQUEST_COMPLETE; hres = E_PENDING; } else @@ -778,6 +781,9 @@ done: if (pcbRead) *pcbRead = read;
+ if (hres != E_PENDING) + This->flags |= FLAG_REQUEST_COMPLETE; + return hres; }