ClickHouse/dbms/programs/server/RootRequestHandler.cpp

34 lines
765 B
C++
Raw Normal View History

2017-08-09 14:33:07 +00:00
#include "RootRequestHandler.h"
#include <IO/HTTPCommon.h>
#include <Common/Exception.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
namespace DB
{
void RootRequestHandler::handleRequest(
2017-12-02 02:47:12 +00:00
Poco::Net::HTTPServerRequest &,
2017-08-09 14:33:07 +00:00
Poco::Net::HTTPServerResponse & response)
{
try
{
const auto & config = server.config();
setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10));
2017-08-09 14:33:07 +00:00
response.setContentType("text/html; charset=UTF-8");
const std::string data = config.getString("http_server_default_response", "Ok.\n");
2017-08-09 14:33:07 +00:00
response.sendBuffer(data.data(), data.size());
}
catch (...)
{
tryLogCurrentException("RootRequestHandler");
}
}
}