Module: wine Branch: master Commit: 058761fa34a87ee22d8a2355ca28de4ebb8accb5 URL: http://source.winehq.org/git/wine.git/?a=commit;h=058761fa34a87ee22d8a2355ca...
Author: Hans Leidekker hans@it.vu.nl Date: Wed Mar 26 22:22:04 2008 +0100
wininet: Support chunked reads in InternetReadFileEx too.
---
dlls/wininet/http.c | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 3bb8a76..016a8f0 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1564,7 +1564,7 @@ static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buf return ERROR_INTERNET_INVALID_OPTION; }
-static DWORD HTTPREQ_Read(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) +static DWORD HTTP_Read(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { int bytes_read;
@@ -1611,7 +1611,7 @@ static DWORD get_chunk_size(const char *buffer) return size; }
-static DWORD HTTPREQ_ReadChunked(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) +static DWORD HTTP_ReadChunked(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { char reply[MAX_REPLY_LEN], *p = buffer; DWORD buflen, to_write = size; @@ -1677,20 +1677,25 @@ static DWORD HTTPREQ_ReadChunked(WININETHTTPREQW *req, void *buffer, DWORD size, return ERROR_SUCCESS; }
-static DWORD HTTPREQ_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size, DWORD *read) +static DWORD HTTPREQ_Read(WININETHTTPREQW *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { - WININETHTTPREQW *req = (WININETHTTPREQW*)hdr; - static WCHAR encoding[20]; + WCHAR encoding[20]; DWORD buflen = sizeof(encoding); static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0};
if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_TRANSFER_ENCODING, encoding, &buflen, NULL) && !strcmpiW(encoding, szChunked)) { - return HTTPREQ_ReadChunked(req, buffer, size, read, TRUE); + return HTTP_ReadChunked(req, buffer, size, read, sync); } else - return HTTPREQ_Read(req, buffer, size, read, TRUE); + return HTTP_Read(req, buffer, size, read, sync); +} + +static DWORD HTTPREQ_ReadFile(WININETHANDLEHEADER *hdr, void *buffer, DWORD size, DWORD *read) +{ + WININETHTTPREQW *req = (WININETHTTPREQW*)hdr; + return HTTPREQ_Read(req, buffer, size, read, TRUE); }
static void HTTPREQ_AsyncReadFileExProc(WORKREQUEST *workRequest) @@ -2018,7 +2023,7 @@ static void HTTP_DrainContent(WININETHTTPREQW *req) do { char buffer[2048]; - if (HTTPREQ_Read(req, buffer, sizeof(buffer), &bytes_read, TRUE) != ERROR_SUCCESS) + if (HTTP_Read(req, buffer, sizeof(buffer), &bytes_read, TRUE) != ERROR_SUCCESS) return; } while (bytes_read); }