winhttp: Use netconn_query_data_available in get_available_data when possible.

This commit is contained in:
Jacek Caban 2013-11-01 10:59:50 +01:00 committed by Alexandre Julliard
parent cd5d1e54e7
commit 92426b5136
3 changed files with 15 additions and 16 deletions

View File

@ -712,24 +712,23 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd
return TRUE;
}
BOOL netconn_query_data_available( netconn_t *conn, DWORD *available )
ULONG netconn_query_data_available( netconn_t *conn )
{
#ifdef FIONREAD
int ret;
ULONG unread;
#endif
*available = 0;
if (!netconn_connected( conn )) return FALSE;
if(!netconn_connected(conn))
return 0;
if (conn->secure)
{
*available = conn->peek_len;
return TRUE;
}
if(conn->secure) {
return conn->peek_len;
}else {
#ifdef FIONREAD
if (!(ret = ioctlsocket( conn->socket, FIONREAD, &unread ))) *available = unread;
ULONG unread;
if(!ioctlsocket(conn->socket, FIONREAD, &unread))
return unread;
#endif
return TRUE;
}
return 0;
}
DWORD netconn_set_timeout( netconn_t *netconn, BOOL send, int value )

View File

@ -1955,7 +1955,7 @@ static BOOL start_next_chunk( request_t *request, BOOL notify )
static DWORD get_available_data( request_t *request )
{
if (request->read_chunked) return min( request->read_chunked_size, request->read_size );
return request->read_size;
return request->read_size + netconn_query_data_available( &request->netconn );
}
/* check if we have reached the end of the data to read */

View File

@ -266,7 +266,7 @@ BOOL netconn_connected( netconn_t * ) DECLSPEC_HIDDEN;
BOOL netconn_create( netconn_t *, int, int, int ) DECLSPEC_HIDDEN;
BOOL netconn_init( netconn_t * ) DECLSPEC_HIDDEN;
void netconn_unload( void ) DECLSPEC_HIDDEN;
BOOL netconn_query_data_available( netconn_t *, DWORD * ) DECLSPEC_HIDDEN;
ULONG netconn_query_data_available( netconn_t * ) DECLSPEC_HIDDEN;
BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr *, socklen_t *, int ) DECLSPEC_HIDDEN;
BOOL netconn_secure_connect( netconn_t *, WCHAR * ) DECLSPEC_HIDDEN;