| 15 | { |
| 16 | |
| 17 | WriteBufferFromHTTP::WriteBufferFromHTTP( |
| 18 | const HTTPConnectionGroupType & connection_group, |
| 19 | const Poco::URI & uri, |
| 20 | const std::string & method, |
| 21 | const std::string & content_type, |
| 22 | const std::string & content_encoding, |
| 23 | const HTTPHeaderEntries & additional_headers, |
| 24 | const ConnectionTimeouts & timeouts, |
| 25 | size_t buffer_size_, |
| 26 | ProxyConfiguration proxy_configuration |
| 27 | ) |
| 28 | : WriteBufferFromOStream(buffer_size_) |
| 29 | , session{makeHTTPSession(connection_group, uri, timeouts, proxy_configuration)} |
| 30 | , request{method, uri.getPathAndQuery(), Poco::Net::HTTPRequest::HTTP_1_1} |
| 31 | { |
| 32 | if (uri.getPort()) |
| 33 | request.setHost(uri.getHost(), uri.getPort()); |
| 34 | else |
| 35 | request.setHost(uri.getHost()); |
| 36 | request.setChunkedTransferEncoding(true); |
| 37 | |
| 38 | if (!content_encoding.empty()) |
| 39 | request.set("Content-Encoding", content_encoding); |
| 40 | |
| 41 | for (const auto & header: additional_headers) |
| 42 | request.add(header.name, header.value); |
| 43 | |
| 44 | if (!content_type.empty() && !request.has("Content-Type")) |
| 45 | { |
| 46 | request.set("Content-Type", content_type); |
| 47 | } |
| 48 | |
| 49 | LOG_TRACE((getLogger("WriteBufferToHTTP")), "Sending request to {}", uri.toString()); |
| 50 | |
| 51 | ProfileEvents::increment(ProfileEvents::WriteBufferFromHTTPRequestsSent); |
| 52 | ostr = &session->sendRequest(request); |
| 53 | } |
| 54 | |
| 55 | void WriteBufferFromHTTP::nextImpl() |
| 56 | { |
nothing calls this directly
no test coverage detected