2026-01-21 13:48:32 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2026, Tim Flynn <trflynn89@ladybird.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
|
|
namespace HTTP {
|
|
|
|
|
|
|
|
|
|
enum class CacheMode : u8 {
|
|
|
|
|
// The cache is searched for a matching response. The cache is updated with the server's response.
|
|
|
|
|
Default,
|
|
|
|
|
|
|
|
|
|
// The cache is not searched for a matching response. The cache is not updated with the server's response.
|
|
|
|
|
NoStore,
|
|
|
|
|
|
|
|
|
|
// The cache is not searched for a matching response. The cache is updated with the server's response.
|
|
|
|
|
Reload,
|
|
|
|
|
|
|
|
|
|
// The cache is searched for a matching response, but must always revalidate. The cache is updated with the server's response.
|
|
|
|
|
NoCache,
|
|
|
|
|
|
|
|
|
|
// The cache is searched for a matching fresh or stale response. The cache is updated with the server's response.
|
|
|
|
|
ForceCache,
|
|
|
|
|
|
|
|
|
|
// The cache is searched for a matching fresh or stale response. A cache miss results in a network error.
|
|
|
|
|
OnlyIfCached,
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-20 17:12:36 -05:00
|
|
|
constexpr bool cache_mode_permits_stale_responses(CacheMode cache_mode)
|
|
|
|
|
{
|
|
|
|
|
return cache_mode == CacheMode::ForceCache || cache_mode == CacheMode::OnlyIfCached;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-21 13:48:32 -05:00
|
|
|
}
|