0.29.7
This commit is contained in:
1 parent
ad95bfb050
commit
1431dd47f0
62 files changed
+1360
-198
No files matched your search
Vendored
+12
-2
@@ -188,6 +188,9 @@ impl Settings {
|
||||
value.parse::<HeaderValue>().expect("validated cache Via header"),
|
||||
);
|
||||
}
|
||||
if self.expose_only_hits && outcome != "HIT" {
|
||||
return;
|
||||
}
|
||||
if self.expose_status {
|
||||
headers.insert("x-cache", HeaderValue::from_static(outcome));
|
||||
}
|
||||
@@ -222,7 +225,10 @@ impl Settings {
|
||||
}
|
||||
}
|
||||
pub fn annotate_transformed(&self, headers: &mut HeaderMap, transformed: bool) {
|
||||
if !self.enabled || !self.expose_cache_status || !transformed {
|
||||
if !self.enabled || !self.expose_cache_status || !transformed
|
||||
|| (self.expose_only_hits && !headers.get("cache-status")
|
||||
.and_then(|value| value.to_str().ok())
|
||||
.is_some_and(|value| value.starts_with("RustProxy; hit"))) {
|
||||
return;
|
||||
}
|
||||
let base = headers
|
||||
@@ -249,7 +255,7 @@ impl Settings {
|
||||
reason: &'static str,
|
||||
) {
|
||||
self.annotate(headers, outcome, hits, ttl);
|
||||
if !self.enabled {
|
||||
if !self.enabled || (self.expose_only_hits && outcome != "HIT") {
|
||||
return;
|
||||
}
|
||||
if self.expose_status {
|
||||
@@ -333,6 +339,7 @@ pub struct Overrides {
|
||||
pub expose_hits: Option<bool>,
|
||||
pub expose_cache_status: Option<bool>,
|
||||
pub expose_resident_age: Option<bool>,
|
||||
pub expose_only_hits: Option<bool>,
|
||||
/// Deliberately unavailable in the global cache configuration.
|
||||
pub unsafe_force: UnsafeForce,
|
||||
}
|
||||
@@ -380,6 +387,9 @@ impl Overrides {
|
||||
if let Some(value) = self.expose_resident_age {
|
||||
result.expose_resident_age = value;
|
||||
}
|
||||
if let Some(value) = self.expose_only_hits {
|
||||
result.expose_only_hits = value;
|
||||
}
|
||||
result.validate()?;
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user