Fast reads

This commit is contained in:
Pavel Krymets 2018-04-09 15:16:47 -07:00
parent 5e5aa90575
commit 7a14be006d
1 changed files with 18 additions and 10 deletions

View File

@ -206,18 +206,26 @@ http_read_request_bytes(
}
IHttpRequest *pHttpRequest = (IHttpRequest*)pInProcessHandler->QueryHttpContext()->GetRequest();
BOOL fAsync = TRUE;
hr = pHttpRequest->ReadEntityBody(
pvBuffer,
dwCbBuffer,
fAsync,
pdwBytesReceived,
pfCompletionPending);
if (hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF))
if (pHttpRequest->GetRemainingEntityBytes() > 0)
{
// We reached the end of the data
BOOL fAsync = TRUE;
hr = pHttpRequest->ReadEntityBody(
pvBuffer,
dwCbBuffer,
fAsync,
pdwBytesReceived,
pfCompletionPending);
if (hr == HRESULT_FROM_WIN32(ERROR_HANDLE_EOF))
{
// We reached the end of the data
hr = S_OK;
}
}
else
{
// nothing to read
hr = S_OK;
}