From cd2df80a03e6c52d3b7212553a7791a803a9d5c5 Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 12 Nov 2026 10:26:07 -0600 Subject: [PATCH] S007: servo-net patches: certificate warning Open anyway, keep the HTTP cache at quit (D-014) Co-Authored-By: Claude Opus 5.5 --- docs/DECISIONS.md | 1 + vendor/servo-net/fetch/methods.rs | 4 ++++ vendor/servo-net/http_cache.rs | 12 ++++++++++++ vendor/servo-net/resource_thread.rs | 2 ++ 4 files changed, 19 insertions(+) diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 7f89d2c..4fb7a61 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -16,3 +16,4 @@ - D-011 — 2026-11-12 — Privacy mode (R1-16: anti-fingerprinting, strict cookies, tracker blocking, Cover Your Tracks check, auto-on in incognito) and cookie theft protection (R1-19: Nacre-held cookies encrypted at rest with an OS-keyring key) get their own privacy plan, generated after S021 with /plan-generate; not part of S007. — The user chose it; both are large and touch hub, inject and store. — S007, the new privacy plan - D-012 — 2026-11-12 — servo-net is vendored (`vendor/servo-net`, 0.7.0 + `http2_max_header_list_size(256 KiB)` in `connector.rs` `create_http_client`) via `[patch.crates-io]`. — hyper's 16 KiB HTTP/2 default rejects YouTube's ~19 KiB response headers; Servo can't configure it from the embedder. — any plan that upgrades Servo: drop the patch when servo-net sets the limit, re-run `tests/smoke/heavy-web.txt` - D-013 — 2026-11-12 — New plans: S022 MSE spike (05 Engine) runs right after S006; privacy plans S023 (request headers + third-party cookies in the vendored servo-net), S024 (privacy mode, R1-16), S025 (encrypted cookies, R1-19) run after S009, before the S010 review. — The user wants real YouTube playback in the page (no yt-dlp workaround) and asked whether missing Servo features can be added from reference engines; the spike sizes MSE before committing weeks to it. — S006–S025 run order +- D-014 — 2026-11-12 — Two more Nacre patches in the vendored servo-net (D-012), marked "Nacre patch": `fetch/methods.rs` lets the certificate warning's `chrome:allowcert` request through (it ended as UnsupportedScheme, so "Open anyway" never worked); `http_cache.rs` `flush_to_disk` + `resource_thread.rs` Exit write the memory HTTP cache to the disk cache at quit (Servo only wrote evicted entries, so a session's cache was lost). — Both are Servo 0.7 bugs the embedder can't work around. — any plan that upgrades Servo: re-check both, re-run `tests/smoke/net-privacy.txt` and `cache.txt` + `cache-restart.txt` diff --git a/vendor/servo-net/fetch/methods.rs b/vendor/servo-net/fetch/methods.rs index 7a6b05d..5529c42 100644 --- a/vendor/servo-net/fetch/methods.rs +++ b/vendor/servo-net/fetch/methods.rs @@ -574,6 +574,10 @@ pub async fn main_fetch( else if (same_origin && request.response_tainting == ResponseTainting::Basic) || // request's current URL's scheme is "data" current_scheme == "data" || + // Nacre patch: the certificate warning's "Open anyway" posts to chrome:allowcert from + // the failing site's origin, which ended here as UnsupportedScheme, so the override was + // never stored. handle_allowcert_request still checks the privileged secret. + (current_scheme == "chrome" && current_url.path() == "allowcert") || // Note: Although it is not part of the specification, we make an exception here // for custom protocols that are explicitly marked as active for fetch. context.protocols.is_fetchable(current_scheme) || diff --git a/vendor/servo-net/http_cache.rs b/vendor/servo-net/http_cache.rs index 9782d51..c8bbea7 100644 --- a/vendor/servo-net/http_cache.rs +++ b/vendor/servo-net/http_cache.rs @@ -1072,6 +1072,18 @@ impl HttpCache { .collect() } + /// Nacre patch: write every memory entry to the disk cache. The memory cache moves an entry to + /// disk only when it evicts it, so without this a session's cache was lost at exit. + pub(crate) fn flush_to_disk(&self) { + let Some(disk_cache) = &self.disk_cache else { return }; + let Ok(runtime) = tokio::runtime::Builder::new_current_thread().build() else { return }; + runtime.block_on(async { + for (key, entry) in self.entries.iter() { + disk_cache.store(key, entry).await; + } + }); + } + /// Clear the contents of this cache. pub(crate) fn clear(&self) { self.entries.clear(); diff --git a/vendor/servo-net/resource_thread.rs b/vendor/servo-net/resource_thread.rs index e821d0c..2255cc5 100644 --- a/vendor/servo-net/resource_thread.rs +++ b/vendor/servo-net/resource_thread.rs @@ -663,6 +663,8 @@ impl ResourceChannelManager { sender.send_or_ignore(total); }, CoreResourceMsg::Exit(sender) => { + // Nacre patch: keep this session's HTTP cache for the next start. + http_state.http_cache.flush_to_disk(); if let Some(ref config_dir) = self.config_dir { let auth_cache = http_state.auth_cache.read(); servo_base::write_json_to_file(&*auth_cache, config_dir, "auth_cache.json");