wininet: Propagate WSAEWOULDBLOCK result from content decoding reads.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-03-09 18:18:10 +01:00 committed by Alexandre Julliard
parent c5eca7be91
commit 67b56774c5
1 changed files with 15 additions and 7 deletions

View File

@ -484,10 +484,8 @@ static DWORD gzip_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DW
break; break;
if(!current_read) { if(!current_read) {
if(blocking_mode != BLOCKING_DISALLOW) { WARN("unexpected end of data\n");
WARN("unexpected end of data\n"); gzip_stream->end_of_data = TRUE;
gzip_stream->end_of_data = TRUE;
}
break; break;
} }
} }
@ -518,6 +516,8 @@ static DWORD gzip_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DW
} }
TRACE("read %u bytes\n", ret_read); TRACE("read %u bytes\n", ret_read);
if(ret_read)
res = ERROR_SUCCESS;
*read = ret_read; *read = ret_read;
return res; return res;
} }
@ -2572,6 +2572,12 @@ static DWORD read_http_stream(http_request_t *req, BYTE *buf, DWORD size, DWORD
DWORD res; DWORD res;
res = req->data_stream->vtbl->read(req->data_stream, req, buf, size, read, blocking_mode); res = req->data_stream->vtbl->read(req->data_stream, req, buf, size, read, blocking_mode);
if(res != ERROR_SUCCESS) {
if(res != WSAEWOULDBLOCK)
return res;
*read = 0;
return ERROR_SUCCESS;
}
assert(*read <= size); assert(*read <= size);
if(req->hCacheFile) { if(req->hCacheFile) {
@ -2584,7 +2590,7 @@ static DWORD read_http_stream(http_request_t *req, BYTE *buf, DWORD size, DWORD
FIXME("WriteFile failed: %u\n", GetLastError()); FIXME("WriteFile failed: %u\n", GetLastError());
} }
if(req->data_stream->vtbl->end_of_data(req->data_stream, req)) if(!*read || req->data_stream->vtbl->end_of_data(req->data_stream, req))
commit_cache_entry(req); commit_cache_entry(req);
} }
@ -2669,7 +2675,7 @@ static DWORD netconn_read(data_stream_t *stream, http_request_t *req, BYTE *buf,
break; break;
} }
if(ret || (blocking_mode == BLOCKING_DISALLOW && res == WSAEWOULDBLOCK)) if(res == WSAEWOULDBLOCK && ret)
res = ERROR_SUCCESS; res = ERROR_SUCCESS;
} }
@ -2750,6 +2756,8 @@ static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf,
if(res == ERROR_SUCCESS && read_bytes) { if(res == ERROR_SUCCESS && read_bytes) {
chunked_stream->buf_size += read_bytes; chunked_stream->buf_size += read_bytes;
}else if(res == WSAEWOULDBLOCK) { }else if(res == WSAEWOULDBLOCK) {
if(ret_read)
res = ERROR_SUCCESS;
continue_read = FALSE; continue_read = FALSE;
continue; continue;
}else { }else {
@ -2853,7 +2861,7 @@ static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf,
if(ret_read) if(ret_read)
res = ERROR_SUCCESS; res = ERROR_SUCCESS;
if(res != ERROR_SUCCESS && res != WSAEWOULDBLOCK) if(res != ERROR_SUCCESS)
return res; return res;
TRACE("read %d bytes\n", ret_read); TRACE("read %d bytes\n", ret_read);