mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
winhttp: Mind read size when skipping async read in WinHttpReadData().
This commit is contained in:
parent
a3686eeb5e
commit
9c1bc32fe9
1 changed files with 6 additions and 4 deletions
|
@ -3062,9 +3062,11 @@ static DWORD query_data_ready( struct request *request )
|
|||
return count;
|
||||
}
|
||||
|
||||
static BOOL skip_async_queue( struct request *request, BOOL *wont_block )
|
||||
static BOOL skip_async_queue( struct request *request, BOOL *wont_block, DWORD to_read )
|
||||
{
|
||||
*wont_block = end_of_read_data( request ) || query_data_ready( request );
|
||||
if (!request->read_chunked)
|
||||
to_read = min( to_read, request->content_length - request->content_read );
|
||||
*wont_block = end_of_read_data( request ) || query_data_ready( request ) >= to_read;
|
||||
return request->hdr.recursion_count < 3 && *wont_block;
|
||||
}
|
||||
|
||||
|
@ -3133,7 +3135,7 @@ BOOL WINAPI WinHttpQueryDataAvailable( HINTERNET hrequest, LPDWORD available )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block ))
|
||||
if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block, 1 ))
|
||||
{
|
||||
ret = query_data_available( request, available, async );
|
||||
}
|
||||
|
@ -3229,7 +3231,7 @@ BOOL WINAPI WinHttpReadData( HINTERNET hrequest, void *buffer, DWORD to_read, DW
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block ))
|
||||
if (!(async = request->connect->hdr.flags & WINHTTP_FLAG_ASYNC) || skip_async_queue( request, &wont_block, to_read ))
|
||||
{
|
||||
ret = read_data( request, buffer, to_read, read, async );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue