This commit is contained in:
Mateusz Gruszczyński committed 2026-10-11 22:12:27 +02:00
1 parent 75104f87ba
commit 4cc994b3bc
86 files changed
+942 -223

No files matched your search

+24
View File
@@ -69,6 +69,30 @@ mod cache_revision_tests {
CacheInvalidation::None
));
for label in ["http2", "http3"] {
let mut protocol_only = base.clone();
if label == "http2" {
protocol_only.vhosts[0].http2_enabled = !base.vhosts[0].http2_enabled;
} else {
protocol_only.vhosts[0].http3_enabled = !base.vhosts[0].http3_enabled;
}
// The effective configuration really changes, but the cache key
// does not. This must hold for both toggling directions.
assert_ne!(
(protocol_only.vhosts[0].http2_enabled, protocol_only.vhosts[0].http3_enabled),
(base.vhosts[0].http2_enabled, base.vhosts[0].http3_enabled),
"{label} toggle did not change a transport switch"
);
assert_eq!(cache_revision(&protocol_only), identity, "{label} rotated cache");
assert!(matches!(cache_invalidation(&base, &protocol_only), CacheInvalidation::None));
assert!(matches!(cache_invalidation(&protocol_only, &base), CacheInvalidation::None));
}
let mut both_protocols = base.clone();
both_protocols.vhosts[0].http2_enabled = !base.vhosts[0].http2_enabled;
both_protocols.vhosts[0].http3_enabled = !base.vhosts[0].http3_enabled;
assert_eq!(cache_revision(&both_protocols), identity);
assert!(matches!(cache_invalidation(&base, &both_protocols), CacheInvalidation::None));
let mut vhost_diagnostics = base.clone();
vhost_diagnostics.vhosts[0].cache.expose_only_hits = Some(true);
assert_eq!(cache_revision(&vhost_diagnostics), identity);
+5
View File
@@ -117,6 +117,11 @@ fn cache_revision(config: &config::Config) -> u64 {
let mut vhosts = config.vhosts.clone();
for vhost in &mut vhosts {
vhost.cache.expose_only_hits = None;
// Frontend ALPN/QUIC switches decide how a client reaches a vhost,
// not which representation the origin returns. Hot and cold entries
// must survive HTTP/2 or HTTP/3 opt-in/out saves.
vhost.http2_enabled = true;
vhost.http3_enabled = true;
}
let encoded = serde_json::to_vec(&(
&cache,