1 | #include <IO/WriteBufferFromHTTP.h> |
2 | |
3 | #include <common/logger_useful.h> |
4 | |
5 | |
6 | namespace DB |
7 | { |
8 | |
9 | WriteBufferFromHTTP::WriteBufferFromHTTP( |
10 | const Poco::URI & uri, const std::string & method, const ConnectionTimeouts & timeouts, size_t buffer_size_) |
11 | : WriteBufferFromOStream(buffer_size_) |
12 | , session{makeHTTPSession(uri, timeouts)} |
13 | , request{method, uri.getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1} |
14 | { |
15 | request.setHost(uri.getHost()); |
16 | request.setChunkedTransferEncoding(true); |
17 | |
18 | LOG_TRACE((&Logger::get("WriteBufferToHTTP" )), "Sending request to " << uri.toString()); |
19 | |
20 | ostr = &session->sendRequest(request); |
21 | } |
22 | |
23 | void WriteBufferFromHTTP::finalize() |
24 | { |
25 | receiveResponse(*session, request, response, false); |
26 | /// TODO: Response body is ignored. |
27 | } |
28 | |
29 | } |
30 | |