2014-03-21 13:42:14 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-06-15 14:33:46 +00:00
|
|
|
#include <Interpreters/InterserverCredentials.h>
|
2021-02-19 12:51:26 +00:00
|
|
|
#include <Server/HTTP/HTTPRequestHandler.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Common/CurrentMetrics.h>
|
2014-03-21 13:42:14 +00:00
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
#include <Poco/Logger.h>
|
|
|
|
|
|
|
|
#include <memory>
|
2021-04-06 16:31:24 +00:00
|
|
|
#include <string>
|
2021-02-19 12:51:26 +00:00
|
|
|
|
2014-03-21 13:42:14 +00:00
|
|
|
|
2016-10-24 04:06:27 +00:00
|
|
|
namespace CurrentMetrics
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
extern const Metric InterserverConnection;
|
2016-10-24 04:06:27 +00:00
|
|
|
}
|
|
|
|
|
2014-03-21 13:42:14 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-05-20 17:04:36 +00:00
|
|
|
class IServer;
|
|
|
|
class WriteBufferFromHTTPServerResponse;
|
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
class InterserverIOHTTPHandler : public HTTPRequestHandler
|
2014-03-21 13:42:14 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-09-07 21:04:48 +00:00
|
|
|
explicit InterserverIOHTTPHandler(IServer & server_)
|
2017-04-01 07:20:54 +00:00
|
|
|
: server(server_)
|
2017-08-09 14:33:07 +00:00
|
|
|
, log(&Poco::Logger::get("InterserverIOHTTPHandler"))
|
2017-04-01 07:20:54 +00:00
|
|
|
{
|
|
|
|
}
|
2014-03-21 13:42:14 +00:00
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response) override;
|
2014-03-21 13:42:14 +00:00
|
|
|
|
|
|
|
private:
|
2019-05-20 17:04:36 +00:00
|
|
|
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};
|
|
|
|
|
2021-02-19 12:51:26 +00:00
|
|
|
void processQuery(HTTPServerRequest & request, HTTPServerResponse & response, Output & used_output);
|
2018-07-26 15:10:57 +00:00
|
|
|
|
2021-04-06 13:42:38 +00:00
|
|
|
std::pair<String, bool> checkAuthentication(HTTPServerRequest & request) const;
|
2014-03-21 13:42:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|