Commit 92426b51 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winhttp: Use netconn_query_data_available in get_available_data when possible.

parent cd5d1e54
......@@ -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 )
......
......@@ -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 */
......
......@@ -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;
......
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