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

Method ReadWriteBufferFromHTTP

src/IO/ReadWriteBufferFromHTTP.cpp:188–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188ReadWriteBufferFromHTTP::ReadWriteBufferFromHTTP(
189 const HTTPConnectionGroupType & connection_group_,
190 const Poco::URI & uri_,
191 const std::string & method_,
192 ProxyConfiguration proxy_config_,
193 ReadSettings read_settings_,
194 ConnectionTimeouts timeouts_,
195 const Poco::Net::HTTPBasicCredentials & credentials_,
196 const RemoteHostFilter * remote_host_filter_,
197 size_t buffer_size_,
198 size_t max_redirects_,
199 bool enable_url_encoding_,
200 OutStreamCallback out_stream_callback_,
201 bool use_external_buffer_,
202 bool http_skip_not_found_url_,
203 HTTPHeaderEntries http_header_entries_,
204 bool delay_initialization,
205 std::optional<HTTPFileInfo> file_info_)
206 : SeekableReadBuffer(nullptr, 0)
207 , connection_group(connection_group_)
208 , initial_uri(uri_)
209 , method(!method_.empty() ? method_ : out_stream_callback_ ? Poco::Net::HTTPRequest::HTTP_POST : Poco::Net::HTTPRequest::HTTP_GET)
210 , proxy_config(std::move(proxy_config_))
211 , read_settings(std::move(read_settings_))
212 , timeouts(std::move(timeouts_))
213 , credentials(credentials_)
214 , remote_host_filter(remote_host_filter_)
215 , buffer_size(buffer_size_)
216 , max_redirects(max_redirects_)
217 , enable_url_encoding(enable_url_encoding_)
218 , use_external_buffer(use_external_buffer_)
219 , http_skip_not_found_url(http_skip_not_found_url_)
220 , out_stream_callback(std::move(out_stream_callback_))
221 , redirects(0)
222 , http_header_entries {std::move(http_header_entries_)}
223 , file_info(file_info_)
224 , log(getLogger("ReadWriteBufferFromHTTP"))
225{
226 current_uri = initial_uri;
227
228 if (current_uri.getPath().empty())
229 current_uri.setPath("/");
230
231 if (read_settings.http_settings.max_tries <= 0 || read_settings.http_settings.retry_initial_backoff_ms <= 0
232 || read_settings.http_settings.retry_initial_backoff_ms >= read_settings.http_settings.retry_max_backoff_ms)
233 throw Exception(
234 ErrorCodes::BAD_ARGUMENTS,
235 "Invalid setting for http backoff, "
236 "must be http_max_tries >= 1 (current is {}) and "
237 "0 < http_retry_initial_backoff_ms < http_retry_max_backoff_ms (now 0 < {} < {})",
238 read_settings.http_settings.max_tries,
239 read_settings.http_settings.retry_initial_backoff_ms,
240 read_settings.http_settings.retry_max_backoff_ms);
241
242 // Configure User-Agent if it not already set.
243 const std::string user_agent = "User-Agent";
244 auto iter = std::find_if(http_header_entries.begin(), http_header_entries.end(),
245 [&user_agent] (const HTTPHeaderEntry & entry) { return entry.name == user_agent; });

Callers

nothing calls this directly

Calls 10

ExceptionClass · 0.70
getLoggerFunction · 0.50
formatFunction · 0.50
nextFunction · 0.50
emptyMethod · 0.45
getPathMethod · 0.45
setPathMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected