ClickHouse/dbms/programs/server/HTTPHandlerFactory.cpp
alexey-milovidov c7863e1ac6
Clang Tidy, part 7 (#9799)
* Attempt to enable identifier naming check

* Attempt to enable identifier naming check, continue

* Progress on identifier names

* Adopt identifier names check

* Fixed error

* Merge with master

* Fixed build

* Fixed build

* Fixed build

* Fixed build

* Fixed build

* Fixed error

* Fixed error

* Fixed error
2020-03-23 05:12:31 +03:00

44 lines
1.3 KiB
C++

#include "HTTPHandlerFactory.h"
namespace DB
{
HTTPRequestHandlerFactoryMain::HTTPRequestHandlerFactoryMain(IServer & server_, const std::string & name_)
: server(server_), log(&Logger::get(name_)), name(name_)
{
}
Poco::Net::HTTPRequestHandler * HTTPRequestHandlerFactoryMain::createRequestHandler(
const Poco::Net::HTTPServerRequest & request) // override
{
LOG_TRACE(log, "HTTP Request for " << name << ". "
<< "Method: "
<< request.getMethod()
<< ", Address: "
<< request.clientAddress().toString()
<< ", User-Agent: "
<< (request.has("User-Agent") ? request.get("User-Agent") : "none")
<< (request.hasContentLength() ? (", Length: " + std::to_string(request.getContentLength())) : (""))
<< ", Content Type: " << request.getContentType()
<< ", Transfer Encoding: " << request.getTransferEncoding());
for (auto & handler_factory : child_handler_factories)
{
auto handler = handler_factory->createRequestHandler(request);
if (handler != nullptr)
return handler;
}
if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
{
return new NotFoundHandler;
}
return nullptr;
}
}