From: Jacek Caban Subject: wininet: Don't pass BLOCKING_WAITALL to NETCON_recv in netconn_read. Message-Id: <557FF976.4000900@codeweavers.com> Date: Tue, 16 Jun 2015 12:24:54 +0200 --- dlls/wininet/http.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index b7c4661..f4f67cb 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -2659,24 +2659,29 @@ static DWORD netconn_read(data_stream_t *stream, http_request_t *req, BYTE *buf, { netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; DWORD res = ERROR_SUCCESS; - int len = 0; + int len = 0, ret = 0; size = min(size, netconn_stream->content_length-netconn_stream->content_read); if(size && is_valid_netconn(req->netconn)) { - if((res = NETCON_recv(req->netconn, buf, size, blocking_mode, &len))) { - len = 0; - if(blocking_mode == BLOCKING_DISALLOW && res == WSAEWOULDBLOCK) - res = ERROR_SUCCESS; - else + while((res = NETCON_recv(req->netconn, buf+ret, size-ret, + blocking_mode == BLOCKING_WAITALL ? BLOCKING_ALLOW : blocking_mode, &len)) == ERROR_SUCCESS) { + if(!len) { netconn_stream->content_length = netconn_stream->content_read; - }else if(!len) { - netconn_stream->content_length = netconn_stream->content_read; + break; + } + ret += len; + netconn_stream->content_read += len; + if(blocking_mode != BLOCKING_WAITALL || size == ret) + break; } + + if(ret || (blocking_mode == BLOCKING_DISALLOW && res == WSAEWOULDBLOCK)) + res = ERROR_SUCCESS; } - netconn_stream->content_read += *read = len; - TRACE("read %u bytes\n", len); + TRACE("read %u bytes\n", ret); + *read = ret; return res; }