wininet: Support chunked reads in InternetReadFileEx too.
This commit is contained in:
parent
fb2e9a3aba
commit
058761fa34
|
@ -1564,7 +1564,7 @@ static DWORD HTTPREQ_SetOption(WININETHANDLEHEADER *hdr, DWORD option, void *buf
|
||||||
return ERROR_INTERNET_INVALID_OPTION;
|
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;
|
int bytes_read;
|
||||||
|
|
||||||
|
@ -1611,7 +1611,7 @@ static DWORD get_chunk_size(const char *buffer)
|
||||||
return size;
|
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;
|
char reply[MAX_REPLY_LEN], *p = buffer;
|
||||||
DWORD buflen, to_write = size;
|
DWORD buflen, to_write = size;
|
||||||
|
@ -1677,20 +1677,25 @@ static DWORD HTTPREQ_ReadChunked(WININETHTTPREQW *req, void *buffer, DWORD size,
|
||||||
return ERROR_SUCCESS;
|
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;
|
WCHAR encoding[20];
|
||||||
static WCHAR encoding[20];
|
|
||||||
DWORD buflen = sizeof(encoding);
|
DWORD buflen = sizeof(encoding);
|
||||||
static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0};
|
static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0};
|
||||||
|
|
||||||
if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_TRANSFER_ENCODING, encoding, &buflen, NULL) &&
|
if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_TRANSFER_ENCODING, encoding, &buflen, NULL) &&
|
||||||
!strcmpiW(encoding, szChunked))
|
!strcmpiW(encoding, szChunked))
|
||||||
{
|
{
|
||||||
return HTTPREQ_ReadChunked(req, buffer, size, read, TRUE);
|
return HTTP_ReadChunked(req, buffer, size, read, sync);
|
||||||
}
|
}
|
||||||
else
|
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)
|
static void HTTPREQ_AsyncReadFileExProc(WORKREQUEST *workRequest)
|
||||||
|
@ -2018,7 +2023,7 @@ static void HTTP_DrainContent(WININETHTTPREQW *req)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char buffer[2048];
|
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;
|
return;
|
||||||
} while (bytes_read);
|
} while (bytes_read);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue