Merge pull request #7476 from Icinga/bugfix/api-beast-buffer

Always reset Boost beast buffer in HttpServerConnection#ProcessMessages
This commit is contained in:
Michael Friedrich 2019-09-06 09:56:29 +02:00 committed by GitHub
commit 4a005c5d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
// Best practice is to always reset the buffer.
buf = {};
if (!EnsureValidHeaders(*m_Stream, buf, parser, response, yc)) {
break;
}
@ -520,6 +522,8 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc)
break;
}
// Best practice is to always reset the buffer.
buf = {};
if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, yc)) {
break;
}