NetServices: fix parsing raw HTTP bodies without a known size

When parsing a raw HTTP body without a known size, whether or not a request is complete depends on the
end of the connection. Make sure that the parser updates to complete when all the bytes in the buffer have
been read and the connection closed.

Change-Id: I6f055b43ffe4a44da65da85c19b71304d804c800
This commit is contained in:
Niels Sascha Reedijk 2022-10-29 12:23:15 +01:00
parent 3c9045fbbf
commit 477e74d187

View File

@ -354,10 +354,13 @@ HttpRawBodyParser::ParseBody(HttpBuffer& buffer, HttpTransferFunction writeToBod
"Could not write all available body bytes to the target.");
}
if (fBodyBytesTotal && *fBodyBytesTotal == fTransferredBodySize)
return {bytesRead, bytesRead, true};
else
return {bytesRead, bytesRead, false};
if (fBodyBytesTotal) {
if (*fBodyBytesTotal == fTransferredBodySize)
return {bytesRead, bytesRead, true};
else
return {bytesRead, bytesRead, false};
} else
return {bytesRead, bytesRead, readEnd};
}