v0.38.10
This commit is contained in:
1 parent
38a23e2210
commit
45b1fc04c7
36 files changed
+9594
-7892
No files matched your search
Vendored
+10
-5
@@ -187,12 +187,13 @@ pub fn plan_with(
|
||||
if !forced && settings.varnish_compatible && surrogate_no_store(headers) {
|
||||
return None;
|
||||
}
|
||||
let override_public_no_cache = settings.varnish_compatible
|
||||
// Explicit compatibility-mode fallback overrides origin no-cache even when
|
||||
// it does not contain public. Strict mode always follows RFC 9111.
|
||||
let override_no_cache = settings.varnish_compatible
|
||||
&& control.contains_key("no-cache")
|
||||
&& control.contains_key("public")
|
||||
&& settings.default_ttl_seconds > 0;
|
||||
&& (settings.default_ttl_seconds > 0 || overrides.ttl.is_some_and(|ttl| ttl > 0));
|
||||
let requires_revalidation =
|
||||
!forced && control.contains_key("no-cache") && !override_public_no_cache;
|
||||
!forced && control.contains_key("no-cache") && !override_no_cache;
|
||||
let must_revalidate = !forced && control.contains_key("must-revalidate");
|
||||
let proxy_revalidate = !forced && control.contains_key("proxy-revalidate");
|
||||
let parse_window = |name: &str| -> Option<u64> {
|
||||
@@ -219,7 +220,7 @@ pub fn plan_with(
|
||||
Some(ttl)
|
||||
} else if forced {
|
||||
(settings.default_ttl_seconds > 0).then_some(settings.default_ttl_seconds)
|
||||
} else if override_public_no_cache {
|
||||
} else if override_no_cache {
|
||||
Some(settings.default_ttl_seconds)
|
||||
} else if let Some(value) = control.get("s-maxage").or_else(|| control.get("max-age")) {
|
||||
Some(value.as_ref()?.parse::<u64>().ok()?)
|
||||
@@ -233,6 +234,10 @@ pub fn plan_with(
|
||||
)
|
||||
} else if control.contains_key("public") {
|
||||
Some(settings.default_ttl_seconds)
|
||||
} else if settings.varnish_compatible && settings.default_ttl_seconds > 0 {
|
||||
// In compatibility mode a configured default TTL can also be used
|
||||
// for headerless, otherwise eligible 200s (Varnish default_ttl style).
|
||||
Some(settings.default_ttl_seconds)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user