MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / WriteBufferFromHTTP

Method WriteBufferFromHTTP

src/IO/WriteBufferFromHTTP.cpp:17–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15{
16
17WriteBufferFromHTTP::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
55void WriteBufferFromHTTP::nextImpl()
56{

Callers

nothing calls this directly

Calls 14

makeHTTPSessionFunction · 0.85
getPathAndQueryMethod · 0.80
getHostMethod · 0.80
getLoggerFunction · 0.50
incrementFunction · 0.50
getPortMethod · 0.45
setHostMethod · 0.45
emptyMethod · 0.45
setMethod · 0.45
addMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected