Commit 09238973 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Only read as much data as advertized when draining content.

Fixes a regression caused by 2fa86fd6. Signed-off-by: 's avatarHans Leidekker <hans@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7fef84e3
......@@ -1302,13 +1302,20 @@ done:
/* read any content returned by the server so that the connection can be reused */
static void drain_content( request_t *request )
{
DWORD bytes_read;
DWORD size, bytes_read, bytes_total = 0, bytes_left = request->content_length - request->content_read;
char buffer[2048];
refill_buffer( request, FALSE );
for (;;)
{
if (!read_data( request, buffer, sizeof(buffer), &bytes_read, FALSE ) || !bytes_read) return;
if (request->read_chunked) size = sizeof(buffer);
else
{
if (bytes_total >= bytes_left) return;
size = min( sizeof(buffer), bytes_left - bytes_total );
}
if (!read_data( request, buffer, size, &bytes_read, FALSE ) || !bytes_read) return;
bytes_total += bytes_read;
}
}
......
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