mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
We previously waited until we received all response headers before we would create the cache entry. We now create one immediately, and handle writing the headers in its own function. This will allow us to know if a cache entry writer already exists for a given cache key, and thus prevent creating a second writer at the same time.
29 lines
810 B
C++
29 lines
810 B
C++
/*
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/StringView.h>
|
|
#include <AK/Time.h>
|
|
#include <AK/Types.h>
|
|
#include <LibHTTP/HeaderMap.h>
|
|
#include <LibURL/Forward.h>
|
|
|
|
namespace RequestServer {
|
|
|
|
String serialize_url_for_cache_storage(URL::URL const&);
|
|
u64 create_cache_key(StringView url, StringView method);
|
|
|
|
bool is_cacheable(StringView method);
|
|
bool is_cacheable(u32 status_code, HTTP::HeaderMap const&);
|
|
bool is_header_exempted_from_storage(StringView name);
|
|
|
|
AK::Duration calculate_freshness_lifetime(HTTP::HeaderMap const&);
|
|
AK::Duration calculate_age(HTTP::HeaderMap const&, UnixDateTime request_time, UnixDateTime response_time);
|
|
bool is_response_fresh(AK::Duration freshness_lifetime, AK::Duration current_age);
|
|
|
|
}
|