Add example chunked encoding response
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user