2021-02-19 12:51:26 +00:00
|
|
|
#include <Server/NotFoundHandler.h>
|
2017-08-09 14:33:07 +00:00
|
|
|
|
|
|
|
#include <IO/HTTPCommon.h>
|
|
|
|
#include <Common/Exception.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-02-19 12:51:26 +00:00
|
|
|
void NotFoundHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response)
|
2017-08-09 14:33:07 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
|
2021-02-19 12:51:26 +00:00
|
|
|
*response.send() << "There is no handle " << request.getURI() << "\n\n"
|
|
|
|
<< "Use / or /ping for health checks.\n"
|
|
|
|
<< "Or /replicas_status for more sophisticated health checks.\n\n"
|
|
|
|
<< "Send queries from your program with POST method or GET /?query=...\n\n"
|
|
|
|
<< "Use clickhouse-client:\n\n"
|
|
|
|
<< "For interactive data analysis:\n"
|
|
|
|
<< " clickhouse-client\n\n"
|
|
|
|
<< "For batch query processing:\n"
|
|
|
|
<< " clickhouse-client --query='SELECT 1' > result\n"
|
|
|
|
<< " clickhouse-client < query > result\n";
|
2017-08-09 14:33:07 +00:00
|
|
|
}
|
|
|
|
catch (...)
|
|
|
|
{
|
|
|
|
tryLogCurrentException("NotFoundHandler");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-09 22:59:34 +00:00
|
|
|
}
|