Always reset Boost beast buffer in HttpServerConnection#ProcessMessages

refs #7431
This commit is contained in:
Michael Friedrich 2019-09-06 09:31:16 +02:00
parent 1f50a705f9
commit eabba2de42
1 changed files with 4 additions and 0 deletions

View File

@ -475,6 +475,8 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
response.set(http::field::server, l_ServerHeader); response.set(http::field::server, l_ServerHeader);
// Best practice is to always reset the buffer.
buf = {};
if (!EnsureValidHeaders(*m_Stream, buf, parser, response, yc)) { if (!EnsureValidHeaders(*m_Stream, buf, parser, response, yc)) {
break; break;
} }
@ -520,6 +522,8 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
break; break;
} }
// Best practice is to always reset the buffer.
buf = {};
if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, yc)) { if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, yc)) {
break; break;
} }