aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Server/NotFoundHandler.cpp
blob: 5b1db508551580e96627719f6ceab06f0b8167e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <Server/NotFoundHandler.h>

#include <IO/HTTPCommon.h>
#include <Common/Exception.h>

namespace DB
{
void NotFoundHandler::handleRequest(HTTPServerRequest & request, HTTPServerResponse & response)
{
    try
    {
        response.setStatusAndReason(Poco::Net::HTTPResponse::HTTP_NOT_FOUND);
        *response.send() << "There is no handle " << request.getURI()
                         << (!hints.empty() ? fmt::format(". Maybe you meant {}.", hints.front()) : "") << "\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";
    }
    catch (...)
    {
        tryLogCurrentException("NotFoundHandler");
    }
}

}