ladybird/Libraries
Timothy Flynn 3516a2344f LibRequests+RequestServer: Begin implementing an HTTP disk cache
This adds a disk cache for HTTP responses received from the network. For
now, we take a rather conservative approach to caching. We don't cache a
response until we're 100% sure it is cacheable (there are heuristics we
can implement in the future based on the absence of specific headers).

The cache is broken into 2 categories of files:

1. An index file. This is a SQL database containing metadata about each
   cache entry (URL, timestamps, etc.).
2. Cache files. Each cached response is in its own file. The file is an
   amalgamation of all info needed to reconstruct an HTTP response. This
   includes the status code, headers, body, etc.

A cache entry is created once we receive the headers for a response. The
index, however, is not updated at this point. We stream the body into
the cache entry as it is received. Once we've successfully cached the
entire body, we create an index entry in the database. If any of these
steps failed along the way, the cache entry is removed and the index is
left untouched.

Subsequent requests are checked for cache hits from the index. If a hit
is found, we read just enough of the cache entry to inform WebContent of
the status code and headers. The body of the response is piped to WC via
syscalls, such that the transfer happens entirely in the kernel; no need
to allocate the memory for the body in userspace (WC still allocates a
buffer to hold the data, of course). If an error occurs while piping the
body, we currently error out the request. There is a FIXME to switch to
a network request.

Cache hits are also validated for freshness before they are used. If a
response has expired, we remove it and its index entry, and proceed with
a network request.
2025-10-14 13:40:33 +02:00
..
LibCompress CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibCore LibCore: Add a system wrapper to pipe a file 2025-10-14 13:40:33 +02:00
LibCrypto Everywhere: Use Optional<T>::ensure() where useful 2025-09-17 12:01:18 -04:00
LibDatabase LibDatabase: Support all C++ integral types in SQL storage 2025-10-14 13:40:33 +02:00
LibDevTools LibDevTools: Don't assume computed layout values are strings 2025-09-26 22:31:24 +02:00
LibDiff CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibDNS LibDNS: Remove LibCore::DateTime dependency 2025-09-30 12:39:01 +02:00
LibFileSystem CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibGC LibGC: Mark Ptr::as_nonnull as a const function 2025-10-08 17:25:29 +02:00
LibGfx LibWeb: Add support for bitmap scaling in createImageBitmap() 2025-10-14 12:19:33 +02:00
LibHTTP CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibIDL LibIDL: Support extended attributes on namespace members 2025-09-11 17:06:44 +01:00
LibImageDecoderClient CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibIPC LibIPC: Shutdown IPC handler when transport is lost during sync event 2025-10-07 17:04:32 -05:00
LibJS LibJS: Avoid function call if @@hasInstance is default implementation 2025-10-13 17:15:44 +02:00
LibLine Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
LibMain Everywhere: Rename serenity_main to ladybird_main 2025-07-08 09:17:16 -04:00
LibMedia LibMedia: Actually read Matroska tracks' CodecDelay elements 2025-10-02 11:03:26 +02:00
LibRegex LibRegex: Export OpCode/OpCode_Compare for REGEX_DEBUG builds 2025-09-18 11:02:13 +02:00
LibRequests LibRequests+RequestServer: Begin implementing an HTTP disk cache 2025-10-14 13:40:33 +02:00
LibSyntax Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
LibTest Everywhere: Use Optional<T>::ensure() where useful 2025-09-17 12:01:18 -04:00
LibTextCodec LibTextCodec: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
LibThreading LibThreading: Remove Weakable from Thread 2025-09-22 17:28:21 -05:00
LibTLS LibTLS: Use Windows-specific method to set default certificate store 2025-08-23 18:35:45 -06:00
LibUnicode LibUnicode: Query timezone from host config when cache is stale 2025-10-05 15:46:15 +02:00
LibURL LibURL: Add a few missing internal page factories 2025-09-18 07:27:24 -04:00
LibWasm LibWasm: Avoid revalidating memory/address for every element in memory.* 2025-10-06 16:00:02 +02:00
LibWeb LibWeb: Add support for bitmap scaling in createImageBitmap() 2025-10-14 12:19:33 +02:00
LibWebSocket LibWeb: Make WebSocket closure adhere to spec for all ReadyStates 2025-08-18 09:35:47 -06:00
LibWebView LibDatabase+LibWebView: Extract our SQLite wrapper to its own library 2025-10-14 13:40:33 +02:00
LibXML LibWeb+LibXML: Make Listener::set_source(ByteString) fallible 2025-10-02 02:25:28 +02:00
CMakeLists.txt LibDatabase+LibWebView: Extract our SQLite wrapper to its own library 2025-10-14 13:40:33 +02:00