| 1 | #include "PingRequestHandler.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 PingRequestHandler::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 | const char * data = "Ok.\n"; | 
| 23 | response.sendBuffer(data, strlen(data)); | 
| 24 | } | 
| 25 | catch (...) | 
| 26 | { | 
| 27 | tryLogCurrentException( "PingRequestHandler"); | 
| 28 | } | 
| 29 | } | 
| 30 | |
| 31 | } | 
| 32 | 
