1 | #include "RootRequestHandler.h" |
---|---|
2 | |
3 | #include <IO/HTTPCommon.h> |
4 | |
5 | #include <Common/Exception.h> |
6 | |
7 | #include <Poco/Net/HTTPServerRequest.h> |
8 | #include <Poco/Net/HTTPServerResponse.h> |
9 | |
10 | namespace DB |
11 | { |
12 | |
13 | void RootRequestHandler::handleRequest( |
14 | Poco::Net::HTTPServerRequest &, |
15 | Poco::Net::HTTPServerResponse & response) |
16 | { |
17 | try |
18 | { |
19 | const auto & config = server.config(); |
20 | setResponseDefaultHeaders(response, config.getUInt("keep_alive_timeout", 10)); |
21 | |
22 | response.setContentType("text/html; charset=UTF-8"); |
23 | |
24 | const std::string data = config.getString("http_server_default_response", "Ok.\n"); |
25 | response.sendBuffer(data.data(), data.size()); |
26 | } |
27 | catch (...) |
28 | { |
29 | tryLogCurrentException("RootRequestHandler"); |
30 | } |
31 | } |
32 | |
33 | } |
34 |