Add example chunked encoding response

This commit is contained in:
2022-06-30 02:08:09 +02:00
parent 7b93dfa6cf
commit fb84784d1c
14 changed files with 216 additions and 11 deletions
@@ -41,6 +41,7 @@ void RootResponseHandler::sendResponse()
"<body>"
"<h1>asio test webserver</h1>"
"<a href=\"/debug\">Debug</a>"
"<a href=\"/chunked\">Chunked</a>"
"</body>"
"</html>");
@@ -59,7 +60,16 @@ void RootResponseHandler::sendResponse()
void RootResponseHandler::written(std::error_code ec, std::size_t length)
{
if (ec)
{
ESP_LOGW(TAG, "error: %i (%s:%hi)", ec.value(),
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
m_clientConnection.responseFinished(ec);
return;
}
ESP_LOGI(TAG, "expected=%zd actual=%zd for (%s:%hi)", m_response.size(), length,
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
m_clientConnection.responseFinished(ec);
}