mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 19:45:11 +00:00
Update URI filter for query
endpoint once again
This commit is contained in:
parent
b2d930652b
commit
dc31963748
@ -182,15 +182,19 @@ void addDefaultHandlersFactory(
|
|||||||
auto query_handler = std::make_shared<HandlingRuleHTTPHandlerFactory<DynamicQueryHandler>>(std::move(dynamic_creator));
|
auto query_handler = std::make_shared<HandlingRuleHTTPHandlerFactory<DynamicQueryHandler>>(std::move(dynamic_creator));
|
||||||
query_handler->addFilter([](const auto & request)
|
query_handler->addFilter([](const auto & request)
|
||||||
{
|
{
|
||||||
bool pathMatchesGetOrHead = startsWith(request.getURI(), "/?") || startsWith(request.getURI(), "/query?");
|
bool path_matches_get_or_head = startsWith(request.getURI(), "?")
|
||||||
bool isGetOrHeadRequest = request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET
|
|| startsWith(request.getURI(), "/?")
|
||||||
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD;
|
|| startsWith(request.getURI(), "/query?");
|
||||||
|
bool is_get_or_head_request = request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET
|
||||||
|
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_HEAD;
|
||||||
|
|
||||||
bool pathMatchesPostOrOptions = pathMatchesGetOrHead || request.getURI() == "/";
|
bool path_matches_post_or_options = path_matches_get_or_head
|
||||||
bool isPostOrOptionsRequest = request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST
|
|| request.getURI() == "/"
|
||||||
|
|| request.getURI().empty();
|
||||||
|
bool is_post_or_options_request = request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST
|
||||||
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_OPTIONS;
|
|| request.getMethod() == Poco::Net::HTTPRequest::HTTP_OPTIONS;
|
||||||
|
|
||||||
return (pathMatchesGetOrHead && isGetOrHeadRequest) || (pathMatchesPostOrOptions && isPostOrOptionsRequest);
|
return (path_matches_get_or_head && is_get_or_head_request) || (path_matches_post_or_options && is_post_or_options_request);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
factory.addHandler(query_handler);
|
factory.addHandler(query_handler);
|
||||||
|
Loading…
Reference in New Issue
Block a user