Commit 6ea2441f authored by Misha Koshelev's avatar Misha Koshelev Committed by Alexandre Julliard

wininet: InternetQueryDataAvailable does not return ERROR_NO_MORE_FILES when no…

wininet: InternetQueryDataAvailable does not return ERROR_NO_MORE_FILES when no more HTTP data is available.
parent 662f44a6
...@@ -3314,25 +3314,20 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile, ...@@ -3314,25 +3314,20 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
switch (lpwhr->hdr.htype) switch (lpwhr->hdr.htype)
{ {
case WH_HHTTPREQ: case WH_HHTTPREQ:
if (NETCON_query_data_available(&lpwhr->netConnection,
lpdwNumberOfBytesAvailble))
{
retval = TRUE; retval = TRUE;
if (!*lpdwNumberOfBytesAvailble) if (NETCON_query_data_available(&lpwhr->netConnection,
lpdwNumberOfBytesAvailble) &&
!*lpdwNumberOfBytesAvailble)
{ {
/* Even if we are in async mode, we need to determine whether /* Even if we are in async mode, we need to determine whether
* there is actually more data available. We do this by trying * there is actually more data available. We do this by trying
* to peek only a single byte in async mode. */ * to peek only a single byte in async mode. */
BOOL async = (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC); BOOL async = (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC);
if (!NETCON_recv(&lpwhr->netConnection, buffer, if (NETCON_recv(&lpwhr->netConnection, buffer,
min(async ? 1 : sizeof(buffer), min(async ? 1 : sizeof(buffer),
lpwhr->dwContentLength - lpwhr->dwContentRead), lpwhr->dwContentLength - lpwhr->dwContentRead),
MSG_PEEK, (int *)lpdwNumberOfBytesAvailble)) MSG_PEEK, (int *)lpdwNumberOfBytesAvailble) &&
{ async && *lpdwNumberOfBytesAvailble)
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
retval = FALSE;
}
else if (async && *lpdwNumberOfBytesAvailble)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
...@@ -3352,11 +3347,6 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile, ...@@ -3352,11 +3347,6 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile,
} }
} }
} }
}
else
{
INTERNET_SetLastError(ERROR_NO_MORE_FILES);
}
break; break;
default: default:
......
...@@ -572,10 +572,10 @@ BOOL NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int f ...@@ -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) BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available)
{ {
*available = 0;
if (!NETCON_connected(connection)) if (!NETCON_connected(connection))
return FALSE; return FALSE;
*available = 0;
#ifdef SONAME_LIBSSL #ifdef SONAME_LIBSSL
if (connection->peek_msg) *available = connection->peek_len; if (connection->peek_msg) *available = connection->peek_len;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment