mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 01:46:46 +02:00
LibWebView+RequestServer: Add a simple test mode for the HTTP disk cache
This mode allows us to test the HTTP disk cache with two mechanisms: 1. If RequestServer is launched with --http-disk-cache-mode=testing, it will cache requests with a X-Ladybird-Enable-Disk-Cache header. 2. In test mode, RS will include a X-Ladybird-Disk-Cache-Status response header indicating how the response was handled by the cache. There is no standard way for a web request to know what happened with respect to the disk cache, so this fills that hole for testing. This mode is not exposed to users.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
a853bb43ef
commit
b2c112c41a
Notes:
github-actions[bot]
2025-11-20 08:35:41 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/b2c112c41aa Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6861 Reviewed-by: https://github.com/gmta ✅
@@ -213,8 +213,19 @@ ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process()
|
||||
for (auto const& certificate : request_server_options.certificates)
|
||||
arguments.append(ByteString::formatted("--certificate={}", certificate));
|
||||
|
||||
if (request_server_options.enable_http_disk_cache == EnableHTTPDiskCache::Yes)
|
||||
arguments.append("--enable-http-disk-cache"sv);
|
||||
arguments.append("--http-disk-cache-mode"sv);
|
||||
|
||||
switch (request_server_options.http_disk_cache_mode) {
|
||||
case HTTPDiskCacheMode::Disabled:
|
||||
arguments.append("disabled"sv);
|
||||
break;
|
||||
case HTTPDiskCacheMode::Enabled:
|
||||
arguments.append("enabled"sv);
|
||||
break;
|
||||
case HTTPDiskCacheMode::Testing:
|
||||
arguments.append("testing"sv);
|
||||
break;
|
||||
}
|
||||
|
||||
if (auto server = mach_server_name(); server.has_value()) {
|
||||
arguments.append("--mach-server-name"sv);
|
||||
|
||||
Reference in New Issue
Block a user