diff --git a/dbms/src/IO/ReadBufferFromHTTP.cpp b/dbms/src/IO/ReadBufferFromHTTP.cpp index 63c95c7e473..a6c4c83a660 100644 --- a/dbms/src/IO/ReadBufferFromHTTP.cpp +++ b/dbms/src/IO/ReadBufferFromHTTP.cpp @@ -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());