ClickHouse/dbms/src/IO/WriteBufferFromHTTP.cpp

31 lines
798 B
C++
Raw Normal View History

2018-06-15 07:05:14 +00:00
#include <IO/WriteBufferFromHTTP.h>
#include <IO/HTTPCommon.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()
{
2018-06-16 05:54:06 +00:00
receiveResponse(*session, request, response);
/// 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
}