URL format: `http://HOST[:PORT][/PATH]`
-This backend stores data in an HTTP compatible server. The required HTTP
-methods are `GET`, `PUT` and `DELETE`.
+This backend stores data in an HTTP-compatible server. The required HTTP methods
+are `GET`, `PUT` and `DELETE`.
Note that ccache will not perform any cleanup of the HTTP storage.
Known issues and limitations:
-* URLs containing IPv6 addresses like `http://[::1]/` are not supported
-* There are no HTTP timeouts implemented or configured
-* Authentication is not yet supported
-* HTTPS is not yet supported
+* There are no HTTP timeouts implemented or configured.
+* Authentication is not yet supported.
+* HTTPS is not yet supported.
+* URLs containing IPv6 addresses like `http://[::1]/` are not supported.
== Cache size management
nonstd::expected<bool, SecondaryStorage::Error>
FileStorage::put(const Digest& key,
const std::string& value,
- bool only_if_missing)
+ const bool only_if_missing)
{
const auto path = get_entry_path(key);
namespace {
nonstd::string_view
-to_string(httplib::Error error)
+to_string(const httplib::Error error)
{
using httplib::Error;
{
if (!url.port().empty()) {
return Util::parse_unsigned(url.port(), 1, 65535, "port");
- }
- if (url.scheme() == "http") {
+ } else if (url.scheme() == "http") {
return 80;
} else {
throw Error("Unknown scheme: {}", url.scheme());
HttpStorage::get(const Digest& key)
{
const auto url_path = get_entry_path(key);
-
const auto result = m_http_client->Get(url_path.c_str());
if (result.error() != httplib::Error::Success || !result) {
nonstd::expected<bool, SecondaryStorage::Error>
HttpStorage::put(const Digest& key,
const std::string& value,
- bool only_if_missing)
+ const bool only_if_missing)
{
const auto url_path = get_entry_path(key);
}
}
- const auto content_type = "application/octet-stream";
-
+ static const auto content_type = "application/octet-stream";
const auto result = m_http_client->Put(
url_path.c_str(), value.data(), value.size(), content_type);
HttpStorage::remove(const Digest& key)
{
const auto url_path = get_entry_path(key);
-
const auto result = m_http_client->Delete(url_path.c_str());
if (result.error() != httplib::Error::Success || !result) {