Fix HTTP response parsing for HTTP 1.1

refs #5987
This commit is contained in:
Noah Hilverling 2018-01-17 10:25:00 +01:00
parent bea793d24f
commit e19ae4e052
1 changed files with 5 additions and 0 deletions

View File

@ -207,6 +207,11 @@ bool HttpResponse::Parse(StreamReadContext& src, bool may_wait)
lengthIndicator = Convert::ToLong(contentLengthHeader); lengthIndicator = Convert::ToLong(contentLengthHeader);
} }
if (!hasLengthIndicator && ProtocolVersion != HttpVersion10 && !Headers->Contains("transfer-encoding")) {
Complete = true;
return true;
}
if (hasLengthIndicator && src.Eof) if (hasLengthIndicator && src.Eof)
BOOST_THROW_EXCEPTION(std::invalid_argument("Unexpected EOF in HTTP body")); BOOST_THROW_EXCEPTION(std::invalid_argument("Unexpected EOF in HTTP body"));