namespace http = beast::http;
try {
+ /* Do not reset the buffer in the state machine.
+ * EnsureValidHeaders already reads from the stream into the buffer,
+ * EnsureValidBody continues. ProcessRequest() actually handles the request
+ * and needs the full buffer.
+ */
beast::flat_buffer buf;
for (;;) {
response.set(http::field::server, l_ServerHeader);
- // Best practice is to always reset the buffer.
- buf = {};
if (!EnsureValidHeaders(*m_Stream, buf, parser, response, m_ShuttingDown, yc)) {
break;
}
break;
}
- // Best practice is to always reset the buffer.
- buf = {};
if (!EnsureValidBody(*m_Stream, buf, parser, authenticatedUser, response, m_ShuttingDown, yc)) {
break;
}