Module: wine Branch: master Commit: 4f405b228d94c79cebc506053c7d892b7e18a7fa URL: http://source.winehq.org/git/wine.git/?a=commit;h=4f405b228d94c79cebc506053c...
Author: Misha Koshelev mk144210@bcm.edu Date: Mon Aug 13 00:24:57 2007 -0500
urlmon: Fix timing issue with FLAG_REQUEST_COMPLETE and InternetQueryDataAvailable in HttpProtocol_Continue.
---
dlls/urlmon/http.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/urlmon/http.c b/dlls/urlmon/http.c index 08d6419..2d1929d 100644 --- a/dlls/urlmon/http.c +++ b/dlls/urlmon/http.c @@ -661,20 +661,22 @@ static HRESULT WINAPI HttpProtocol_Continue(IInternetProtocol *iface, PROTOCOLDA
if (pProtocolData->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) { + /* 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; - } - else + if (GetLastError() != ERROR_IO_PENDING) { + This->flags |= FLAG_REQUEST_COMPLETE; WARN("InternetQueryDataAvailable failed: %d\n", GetLastError()); HTTPPROTOCOL_ReportResult(This, INET_E_DATA_NOT_AVAILABLE); } } else { + This->flags |= FLAG_REQUEST_COMPLETE; HTTPPROTOCOL_ReportData(This); } }