ClickHouse/programs/server/InterserverIOHTTPHandler.h

48 lines
1.1 KiB
C++
Raw Normal View History

2014-03-21 13:42:14 +00:00
#pragma once
#include <memory>
2017-08-09 14:33:07 +00:00
#include <Poco/Logger.h>
#include <Poco/Net/HTTPRequestHandler.h>
#include <Common/CurrentMetrics.h>
2014-03-21 13:42:14 +00:00
namespace CurrentMetrics
{
extern const Metric InterserverConnection;
}
2014-03-21 13:42:14 +00:00
namespace DB
{
class IServer;
class WriteBufferFromHTTPServerResponse;
2014-03-21 13:42:14 +00:00
class InterserverIOHTTPHandler : public Poco::Net::HTTPRequestHandler
{
public:
explicit InterserverIOHTTPHandler(IServer & server_)
: server(server_)
2017-08-09 14:33:07 +00:00
, log(&Poco::Logger::get("InterserverIOHTTPHandler"))
{
}
2014-03-21 13:42:14 +00:00
void handleRequest(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response) override;
2014-03-21 13:42:14 +00:00
private:
struct Output
{
std::shared_ptr<WriteBufferFromHTTPServerResponse> out;
};
2017-08-09 11:57:09 +00:00
IServer & server;
2017-08-09 14:33:07 +00:00
Poco::Logger * log;
2014-03-21 13:42:14 +00:00
2017-08-09 11:57:09 +00:00
CurrentMetrics::Increment metric_increment{CurrentMetrics::InterserverConnection};
void processQuery(Poco::Net::HTTPServerRequest & request, Poco::Net::HTTPServerResponse & response, Output & used_output);
std::pair<String, bool> checkAuthentication(Poco::Net::HTTPServerRequest & request) const;
2014-03-21 13:42:14 +00:00
};
}