Module: wine Branch: master Commit: 92426b5136355200bfbc9561fcd9601ac130c66a URL: http://source.winehq.org/git/wine.git/?a=commit;h=92426b5136355200bfbc9561fc...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Nov 1 10:59:50 2013 +0100
winhttp: Use netconn_query_data_available in get_available_data when possible.
---
dlls/winhttp/net.c | 27 +++++++++++++-------------- dlls/winhttp/request.c | 2 +- dlls/winhttp/winhttp_private.h | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index 6d9b82a..7466d36 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -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 ) diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 930eb28..db69082 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -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 */ diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 12255ed..a149160 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -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;