0.34.13_cleaup_code
This commit is contained in:
1 parent
ec46a96a29
commit
5c2e50ec06
87 files changed
+4890
-1338
No files matched your search
Vendored
+30
-9
@@ -182,7 +182,15 @@ impl Settings {
|
||||
ttl: u64,
|
||||
reason: &'static str,
|
||||
) {
|
||||
self.annotate_internal(headers, outcome, hits, ttl as i64, Some(reason), false, None);
|
||||
self.annotate_internal(
|
||||
headers,
|
||||
outcome,
|
||||
hits,
|
||||
ttl as i64,
|
||||
Some(reason),
|
||||
false,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn annotate_reason_transformed(
|
||||
@@ -194,7 +202,15 @@ impl Settings {
|
||||
reason: &'static str,
|
||||
transformed: bool,
|
||||
) {
|
||||
self.annotate_internal(headers, outcome, hits, ttl as i64, Some(reason), transformed, None);
|
||||
self.annotate_internal(
|
||||
headers,
|
||||
outcome,
|
||||
hits,
|
||||
ttl as i64,
|
||||
Some(reason),
|
||||
transformed,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn annotate_reason_transformed_freshness(
|
||||
@@ -207,12 +223,16 @@ impl Settings {
|
||||
transformed: bool,
|
||||
) {
|
||||
self.annotate_internal(
|
||||
headers, outcome, hits, freshness_ttl, Some(reason), transformed, None,
|
||||
headers,
|
||||
outcome,
|
||||
hits,
|
||||
freshness_ttl,
|
||||
Some(reason),
|
||||
transformed,
|
||||
None,
|
||||
);
|
||||
}
|
||||
|
||||
// RFC 9211 distinguishes whether this request was forwarded from whether
|
||||
// the legacy X-Cache metric counted the reused representation as a HIT.
|
||||
pub fn annotate_reason_transformed_forwarded(
|
||||
&self,
|
||||
headers: &mut HeaderMap,
|
||||
@@ -285,8 +305,11 @@ impl Settings {
|
||||
}
|
||||
if self.expose_cache_status {
|
||||
let forwarded = forwarded.or_else(|| {
|
||||
matches!(reason, Some("cache_revalidated" | "cache_revalidated_uncached"))
|
||||
.then_some(("stale", Some(StatusCode::NOT_MODIFIED)))
|
||||
matches!(
|
||||
reason,
|
||||
Some("cache_revalidated" | "cache_revalidated_uncached")
|
||||
)
|
||||
.then_some(("stale", Some(StatusCode::NOT_MODIFIED)))
|
||||
});
|
||||
let mut value = if let Some((why, status)) = forwarded {
|
||||
let mut value = format!("RustProxy; fwd={why}");
|
||||
@@ -296,8 +319,6 @@ impl Settings {
|
||||
value
|
||||
} else {
|
||||
match outcome {
|
||||
// RFC 9211 permits a negative ttl when stale data is served
|
||||
// without sending the current request to the origin.
|
||||
"HIT" => format!("RustProxy; hit; ttl={ttl}"),
|
||||
"MISS" => "RustProxy; fwd=miss".to_owned(),
|
||||
"BYPASS" if reason == Some("request_method") => {
|
||||
|
||||
Reference in new issue
Block a user