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
|
|
|
|
{
|
2017-09-08 11:57:43 +00:00
|
|
|
const auto & config = server.config();
|
2017-09-08 16:41:35 +00:00
|
|
|
setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10));
|
2017-09-08 11:57:43 +00:00
|
|
|
|
2017-08-09 14:33:07 +00:00
|
|
|
response.setContentType("text/html; charset=UTF-8");
|
2017-09-08 11:57:43 +00:00
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|