ClickHouse/dbms/IO/WriteBufferFromHTTP.cpp

30 lines
778 B
C++
Raw Normal View History

2018-06-15 07:05:14 +00:00
#include <IO/WriteBufferFromHTTP.h>
#include <common/logger_useful.h>
2018-06-16 05:54:06 +00:00
2018-06-15 07:05:14 +00:00
namespace DB
{
2018-06-16 05:54:06 +00:00
2018-06-15 07:05:14 +00:00
WriteBufferFromHTTP::WriteBufferFromHTTP(
const Poco::URI & uri, const std::string & method, const ConnectionTimeouts & timeouts, size_t buffer_size_)
: WriteBufferFromOStream(buffer_size_)
2018-06-16 05:54:06 +00:00
, session{makeHTTPSession(uri, timeouts)}
2018-06-15 07:05:14 +00:00
, request{method, uri.getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1}
{
request.setHost(uri.getHost());
request.setChunkedTransferEncoding(true);
LOG_TRACE((&Logger::get("WriteBufferToHTTP")), "Sending request to " << uri.toString());
ostr = &session->sendRequest(request);
}
2018-06-16 05:54:06 +00:00
2018-06-15 07:05:14 +00:00
void WriteBufferFromHTTP::finalize()
{
receiveResponse(*session, request, response, false);
2018-06-16 05:54:06 +00:00
/// TODO: Response body is ignored.
2018-06-15 07:05:14 +00:00
}
2018-06-16 05:54:06 +00:00
2018-06-15 07:05:14 +00:00
}