Add websocket header tests

This commit is contained in:
2022-07-05 11:26:23 +02:00
parent 1fe9c38914
commit f12c21b41b
12 changed files with 205 additions and 49 deletions
@@ -16,14 +16,14 @@ constexpr const char * const TAG = "ASIO_WEBSERVER";
ChunkedResponseHandler::ChunkedResponseHandler(ClientConnection &clientConnection) :
m_clientConnection{clientConnection}
{
ESP_LOGV(TAG, "constructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "constructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
ChunkedResponseHandler::~ChunkedResponseHandler()
{
ESP_LOGV(TAG, "destructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "destructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
void ChunkedResponseHandler::requestHeaderReceived(std::string_view key, std::string_view value)
@@ -16,14 +16,14 @@ constexpr const char * const TAG = "ASIO_WEBSERVER";
DebugResponseHandler::DebugResponseHandler(ClientConnection &clientConnection, std::string_view method, std::string_view path, std::string_view protocol) :
m_clientConnection{clientConnection}, m_method{method}, m_path{path}, m_protocol{protocol}
{
ESP_LOGI(TAG, "constructed for %.*s %.*s (%s:%hi)", m_method.size(), m_method.data(), path.size(), path.data(),
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "constructed for %.*s %.*s (%s:%hi)", m_method.size(), m_method.data(), path.size(), path.data(),
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
DebugResponseHandler::~DebugResponseHandler()
{
ESP_LOGI(TAG, "destructed for %.*s %.*s (%s:%hi)", m_method.size(), m_method.data(), m_path.size(), m_path.data(),
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "destructed for %.*s %.*s (%s:%hi)", m_method.size(), m_method.data(), m_path.size(), m_path.data(),
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
void DebugResponseHandler::requestHeaderReceived(std::string_view key, std::string_view value)
@@ -17,14 +17,14 @@ ErrorResponseHandler::ErrorResponseHandler(ClientConnection &clientConnection, s
m_clientConnection{clientConnection},
m_path{path}
{
ESP_LOGI(TAG, "constructed for %.*s (%s:%hi)", path.size(), path.data(),
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "constructed for %.*s (%s:%hi)", path.size(), path.data(),
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
ErrorResponseHandler::~ErrorResponseHandler()
{
ESP_LOGI(TAG, "destructed for %.*s (%s:%hi)", m_path.size(), m_path.data(),
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "destructed for %.*s (%s:%hi)", m_path.size(), m_path.data(),
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
void ErrorResponseHandler::requestHeaderReceived(std::string_view key, std::string_view value)
@@ -16,14 +16,14 @@ constexpr const char * const TAG = "ASIO_WEBSERVER";
RootResponseHandler::RootResponseHandler(ClientConnection &clientConnection) :
m_clientConnection{clientConnection}
{
ESP_LOGI(TAG, "constructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "constructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
RootResponseHandler::~RootResponseHandler()
{
ESP_LOGI(TAG, "destructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "destructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
void RootResponseHandler::requestHeaderReceived(std::string_view key, std::string_view value)
@@ -132,14 +132,14 @@ constexpr std::string_view html{R"END(
WebsocketResponseHandler::WebsocketResponseHandler(ClientConnection &clientConnection) :
m_clientConnection{clientConnection}
{
ESP_LOGI(TAG, "constructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "constructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
WebsocketResponseHandler::~WebsocketResponseHandler()
{
ESP_LOGI(TAG, "destructed for (%s:%hi)",
m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
// ESP_LOGV(TAG, "destructed for (%s:%hi)",
// m_clientConnection.remote_endpoint().address().to_string().c_str(), m_clientConnection.remote_endpoint().port());
}
void WebsocketResponseHandler::requestHeaderReceived(std::string_view key, std::string_view value)