mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
fix GET /path?params
This commit is contained in:
parent
02b4a4aded
commit
636cbe4323
@ -48,26 +48,29 @@ ReadBufferFromHTTP::ReadBufferFromHTTP(
|
||||
method = Poco::Net::HTTPRequest::HTTP_POST;
|
||||
|
||||
std::stringstream uri;
|
||||
uri << "http://" << host << ":" << port << "/" << path;
|
||||
std::stringstream path_params;
|
||||
path_params << "/" << path;
|
||||
|
||||
bool first = true;
|
||||
for (const auto & it : params)
|
||||
{
|
||||
uri << (first ? "?" : "&");
|
||||
path_params << (first ? "?" : "&");
|
||||
first = false;
|
||||
String encoded_key;
|
||||
String encoded_value;
|
||||
Poco::URI::encode(it.first, "=&#", encoded_key);
|
||||
Poco::URI::encode(it.second, "&#", encoded_value);
|
||||
uri << encoded_key << "=" << encoded_value;
|
||||
path_params << encoded_key << "=" << encoded_value;
|
||||
}
|
||||
|
||||
uri << "http://" << host << ":" << port << path_params.str();
|
||||
|
||||
session.setHost(resolveHost(host).toString()); /// Cache DNS forever (until server restart)
|
||||
session.setPort(port);
|
||||
|
||||
session.setTimeout(connection_timeout, send_timeout, receive_timeout);
|
||||
|
||||
Poco::Net::HTTPRequest request(method, "/" + path);
|
||||
Poco::Net::HTTPRequest request(method, path_params.str());
|
||||
Poco::Net::HTTPResponse response;
|
||||
|
||||
LOG_TRACE((&Logger::get("ReadBufferFromHTTP")), "Sending request to " << uri.str());
|
||||
|
Loading…
Reference in New Issue
Block a user