mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
RequestServer: Remove headers exempted from storage from in-memory cache
We previously excluded headers exempted from storage when we serialized the headers into the database. However, we stored the original headers in-memory. So when a subsequent request hit CacheIndex::find_entry, we would return an entry with response headers that should have been excluded.
This commit is contained in:
parent
a580392109
commit
71f9c77ee1
Notes:
github-actions[bot]
2025-11-20 08:36:03 +00:00
Author: https://github.com/trflynn89
Commit: 71f9c77ee1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6861
Reviewed-by: https://github.com/gmta ✅
1 changed files with 9 additions and 3 deletions
|
|
@ -18,9 +18,6 @@ static ByteString serialize_headers(HTTP::HeaderMap const& headers)
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
||||||
for (auto const& header : headers.headers()) {
|
for (auto const& header : headers.headers()) {
|
||||||
if (is_header_exempted_from_storage(header.name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
builder.append(header.name);
|
builder.append(header.name);
|
||||||
builder.append(':');
|
builder.append(':');
|
||||||
builder.append(header.value);
|
builder.append(header.value);
|
||||||
|
|
@ -116,6 +113,15 @@ void CacheIndex::create_entry(u64 cache_key, String url, HTTP::HeaderMap respons
|
||||||
{
|
{
|
||||||
auto now = UnixDateTime::now();
|
auto now = UnixDateTime::now();
|
||||||
|
|
||||||
|
for (size_t i = 0; i < response_headers.headers().size();) {
|
||||||
|
auto const& header = response_headers.headers()[i];
|
||||||
|
|
||||||
|
if (is_header_exempted_from_storage(header.name))
|
||||||
|
response_headers.remove(header.name);
|
||||||
|
else
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
Entry entry {
|
Entry entry {
|
||||||
.cache_key = cache_key,
|
.cache_key = cache_key,
|
||||||
.url = move(url),
|
.url = move(url),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue