S007: servo-net patches: certificate warning Open anyway, keep the HTTP cache at quit (D-014)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 10:26:07 -06:00
commit cd2df80a03
4 changed files with 19 additions and 0 deletions

View file

@ -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`

View file

@ -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) ||

View file

@ -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();

View file

@ -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");