ClickHouse/dbms/programs/server/PingRequestHandler.cpp

32 lines
642 B
C++
Raw Normal View History

2017-08-09 14:33:07 +00:00
#include "PingRequestHandler.h"
#include <IO/HTTPCommon.h>
#include <Common/Exception.h>
#include <Poco/Net/HTTPServerRequest.h>
#include <Poco/Net/HTTPServerResponse.h>
namespace DB
{
void PingRequestHandler::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
const char * data = "Ok.\n";
response.sendBuffer(data, strlen(data));
}
catch (...)
{
tryLogCurrentException("PingRequestHandler");
}
}
}