enum class Layout : uint8_t { bazel, flat, subdirs };
Url m_url;
+ std::string m_redacted_url;
std::string m_url_path;
httplib::Client m_http_client;
Layout m_layout = Layout::subdirs;
HttpStorageBackend::HttpStorageBackend(
const Url& url, const std::vector<Backend::Attribute>& attributes)
: m_url(url),
+ m_redacted_url(get_redacted_url_str_for_logging(url)),
m_url_path(get_url_path(url)),
m_http_client(get_url(url))
{
{
const auto url_path = get_entry_path(key);
const auto result = m_http_client.Get(url_path);
- LOG("GET {}{} -> {}", m_url.str(), url_path, result->status);
+ LOG("GET {}{} -> {}", m_redacted_url, url_path, result->status);
if (result.error() != httplib::Error::Success || !result) {
LOG("Failed to get {} from http storage: {} ({})",
if (overwrite == Overwrite::no) {
const auto result = m_http_client.Head(url_path);
- LOG("HEAD {}{} -> {}", m_url.str(), url_path, result->status);
+ LOG("HEAD {}{} -> {}", m_redacted_url, url_path, result->status);
if (result.error() != httplib::Error::Success || !result) {
LOG("Failed to check for {} in http storage: {} ({})",
reinterpret_cast<const char*>(value.data()),
value.size(),
content_type);
- LOG("PUT {}{} -> {}", m_url.str(), url_path, result->status);
+ LOG("PUT {}{} -> {}", m_redacted_url, url_path, result->status);
if (result.error() != httplib::Error::Success || !result) {
LOG("Failed to put {} to http storage: {} ({})",
{
const auto url_path = get_entry_path(key);
const auto result = m_http_client.Delete(url_path);
- LOG("DELETE {}{} -> {}", m_url.str(), url_path, result->status);
+ LOG("DELETE {}{} -> {}", m_redacted_url, url_path, result->status);
if (result.error() != httplib::Error::Success || !result) {
LOG("Failed to delete {} from http storage: {} ({})",
}
}
+std::string
+get_redacted_url_str_for_logging(const Url& url)
+{
+ Url redacted_url(url);
+ if (!url.user_info().empty()) {
+ redacted_url.user_info(k_redacted_password);
+ }
+ return redacted_url.str();
+}
+
Storage::Storage(const Config& config)
: local(config),
m_config(config)
return !m_remote_storages.empty();
}
-static std::string
-get_redacted_url_str_for_logging(const Url& url)
-{
- Url redacted_url(url);
- if (!url.user_info().empty()) {
- redacted_url.user_info(k_redacted_password);
- }
- return redacted_url.str();
-}
-
std::string
Storage::get_remote_storage_config_for_logging() const
{