Skip to content

Commit

Permalink
Always reset Boost beast buffer in HttpServerConnection#ProcessMessages
Browse files Browse the repository at this point in the history
refs #7431
  • Loading branch information
Michael Friedrich committed Sep 6, 2019
1 parent 1f50a70 commit eabba2d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/remote/httpserverconnection.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit eabba2d

Please sign in to comment.