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
|
|
|
|
{
|
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
|
|
|
const char * data = "Ok.\n";
|
|
|
|
response.sendBuffer(data, strlen(data));
|
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
tryLogCurrentException("PingRequestHandler");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|