Misha Koshelev : wininet:
InternetQueryDataAvailable does not return ERROR_NO_MORE_FILES when no
more HTTP data is available .
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 13 06:31:51 CDT 2007
Module: wine
Branch: master
Commit: 6ea2441ff935c509a9c6548b1c2dd178d2669574
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6ea2441ff935c509a9c6548b1c2dd178d2669574
Author: Misha Koshelev <mk144210 at bcm.edu>
Date: Sun Aug 12 15:40:46 2007 -0500
wininet: InternetQueryDataAvailable does not return ERROR_NO_MORE_FILES when no more HTTP data is available.
---
dlls/wininet/internet.c | 58 +++++++++++++++++------------------------
dlls/wininet/netconnection.c | 2 +-
2 files changed, 25 insertions(+), 35 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 14cfd04..bfad36c 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -3314,49 +3314,39 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
switch (lpwhr->hdr.htype)
{
case WH_HHTTPREQ:
+ retval = TRUE;
if (NETCON_query_data_available(&lpwhr->netConnection,
- lpdwNumberOfBytesAvailble))
+ lpdwNumberOfBytesAvailble) &&
+ !*lpdwNumberOfBytesAvailble)
{
- retval = TRUE;
- if (!*lpdwNumberOfBytesAvailble)
+ /* Even if we are in async mode, we need to determine whether
+ * there is actually more data available. We do this by trying
+ * to peek only a single byte in async mode. */
+ BOOL async = (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC);
+ if (NETCON_recv(&lpwhr->netConnection, buffer,
+ min(async ? 1 : sizeof(buffer),
+ lpwhr->dwContentLength - lpwhr->dwContentRead),
+ MSG_PEEK, (int *)lpdwNumberOfBytesAvailble) &&
+ async && *lpdwNumberOfBytesAvailble)
{
- /* Even if we are in async mode, we need to determine whether
- * there is actually more data available. We do this by trying
- * to peek only a single byte in async mode. */
- BOOL async = (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC);
- if (!NETCON_recv(&lpwhr->netConnection, buffer,
- min(async ? 1 : sizeof(buffer),
- lpwhr->dwContentLength - lpwhr->dwContentRead),
- MSG_PEEK, (int *)lpdwNumberOfBytesAvailble))
+ WORKREQUEST workRequest;
+
+ *lpdwNumberOfBytesAvailble = 0;
+ workRequest.asyncproc = AsyncInternetQueryDataAvailableProc;
+ workRequest.hdr = WININET_AddRef( &lpwhr->hdr );
+
+ retval = INTERNET_AsyncCall(&workRequest);
+ if (!retval)
{
- INTERNET_SetLastError(ERROR_NO_MORE_FILES);
- retval = FALSE;
+ WININET_Release( &lpwhr->hdr );
}
- else if (async && *lpdwNumberOfBytesAvailble)
+ else
{
- WORKREQUEST workRequest;
-
- *lpdwNumberOfBytesAvailble = 0;
- workRequest.asyncproc = AsyncInternetQueryDataAvailableProc;
- workRequest.hdr = WININET_AddRef( &lpwhr->hdr );
-
- retval = INTERNET_AsyncCall(&workRequest);
- if (!retval)
- {
- WININET_Release( &lpwhr->hdr );
- }
- else
- {
- INTERNET_SetLastError(ERROR_IO_PENDING);
- retval = FALSE;
- }
+ INTERNET_SetLastError(ERROR_IO_PENDING);
+ retval = FALSE;
}
}
}
- else
- {
- INTERNET_SetLastError(ERROR_NO_MORE_FILES);
- }
break;
default:
diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c
index 40f3a22..4500a9f 100644
--- a/dlls/wininet/netconnection.c
+++ b/dlls/wininet/netconnection.c
@@ -572,10 +572,10 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f
*/
BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available)
{
+ *available = 0;
if (!NETCON_connected(connection))
return FALSE;
- *available = 0;
#ifdef SONAME_LIBSSL
if (connection->peek_msg) *available = connection->peek_len;
#endif
More information about the wine-cvs
mailing list