#include "LibraryBridgeHandlerFactory.h" #include #include #include "LibraryBridgeHandlers.h" namespace DB { LibraryBridgeHandlerFactory::LibraryBridgeHandlerFactory( const std::string & name_, size_t keep_alive_timeout_, ContextPtr context_) : WithContext(context_) , log(getLogger(name_)) , name(name_) , keep_alive_timeout(keep_alive_timeout_) { } std::unique_ptr LibraryBridgeHandlerFactory::createRequestHandler(const HTTPServerRequest & request) { Poco::URI uri{request.getURI()}; LOG_DEBUG(log, "Request URI: {}", uri.toString()); if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET) { if (uri.getPath() == "/extdict_ping") return std::make_unique(keep_alive_timeout, getContext()); else if (uri.getPath() == "/catboost_ping") return std::make_unique(keep_alive_timeout, getContext()); } if (request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST) { if (uri.getPath() == "/extdict_request") return std::make_unique(keep_alive_timeout, getContext()); else if (uri.getPath() == "/catboost_request") return std::make_unique(keep_alive_timeout, getContext()); } return nullptr; } }