v0.35.1: performance, AGPL licensing and documentation overhaul
- Web Server reads static files inline; proxy middleware chain flattened - About window with license summary and project links; AGPL-3.0-or-later - Rewritten documentation: feature list, screenshots, performance guide - Fix false spikes in per-Vhost request-rate charts
This commit is contained in:
1 parent
d3b492874b
commit
eba9f89283
135 files changed
+1425
-1064
No files matched your search
Vendored
+1
-2
@@ -333,8 +333,7 @@ impl Settings {
|
||||
if transformed {
|
||||
value.push_str("; transformed");
|
||||
}
|
||||
headers.append(
|
||||
"cache-status",
|
||||
headers.append(::http::header::CACHE_STATUS,
|
||||
HeaderValue::from_str(&value).expect("generated Cache-Status member"),
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+18
-17
@@ -68,6 +68,7 @@ pub struct Cache {
|
||||
cold_read_bytes_active: AtomicU64,
|
||||
revalidating: Mutex<HashSet<Key>>,
|
||||
fill_flights: Mutex<HashMap<Key, Arc<FillFlight>>>,
|
||||
uncacheable_until: Mutex<HashMap<Key, std::time::Instant>>,
|
||||
fill_flight_sequence: AtomicU64,
|
||||
collapse_waiters: AtomicU64,
|
||||
bans: Mutex<Vec<BanRule>>,
|
||||
@@ -183,35 +184,35 @@ impl Revalidation {
|
||||
&self.headers
|
||||
}
|
||||
pub fn apply_validators(&self, headers: &mut HeaderMap) -> bool {
|
||||
if headers.contains_key("if-none-match") {
|
||||
let Some(public_etag) = self.headers.get("etag").and_then(|v| v.to_str().ok()) else {
|
||||
if headers.contains_key(::http::header::IF_NONE_MATCH) {
|
||||
let Some(public_etag) = self.headers.get(::http::header::ETAG).and_then(|v| v.to_str().ok()) else {
|
||||
return false;
|
||||
};
|
||||
if !single_if_none_match_matches(headers, public_etag) {
|
||||
return false;
|
||||
}
|
||||
if let Some(origin) = self.origin_etag.clone() {
|
||||
headers.insert("if-none-match", origin);
|
||||
headers.remove("if-modified-since");
|
||||
headers.insert(::http::header::IF_NONE_MATCH, origin);
|
||||
headers.remove(::http::header::IF_MODIFIED_SINCE);
|
||||
return true;
|
||||
}
|
||||
if let Some(modified) = self.origin_last_modified.clone() {
|
||||
headers.remove("if-none-match");
|
||||
headers.insert("if-modified-since", modified);
|
||||
headers.remove(::http::header::IF_NONE_MATCH);
|
||||
headers.insert(::http::header::IF_MODIFIED_SINCE, modified);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if headers.contains_key("if-modified-since") {
|
||||
if headers.contains_key(::http::header::IF_MODIFIED_SINCE) {
|
||||
let Some(cached) = self
|
||||
.headers
|
||||
.get("last-modified")
|
||||
.get(::http::header::LAST_MODIFIED)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let Some(client) = headers
|
||||
.get("if-modified-since")
|
||||
.get(::http::header::IF_MODIFIED_SINCE)
|
||||
.and_then(|v| v.to_str().ok())
|
||||
else {
|
||||
return false;
|
||||
@@ -226,16 +227,16 @@ impl Revalidation {
|
||||
let Some(origin) = self.origin_last_modified.clone() else {
|
||||
return false;
|
||||
};
|
||||
headers.insert("if-modified-since", origin);
|
||||
headers.insert(::http::header::IF_MODIFIED_SINCE, origin);
|
||||
return true;
|
||||
}
|
||||
if let Some(etag) = self.origin_etag.clone() {
|
||||
headers.insert("if-none-match", etag);
|
||||
headers.remove("if-modified-since");
|
||||
headers.insert(::http::header::IF_NONE_MATCH, etag);
|
||||
headers.remove(::http::header::IF_MODIFIED_SINCE);
|
||||
true
|
||||
} else if let Some(modified) = self.origin_last_modified.clone() {
|
||||
headers.insert("if-modified-since", modified);
|
||||
headers.remove("if-none-match");
|
||||
headers.insert(::http::header::IF_MODIFIED_SINCE, modified);
|
||||
headers.remove(::http::header::IF_NONE_MATCH);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
@@ -281,7 +282,7 @@ impl Revalidation {
|
||||
}
|
||||
pub fn merge_validation_headers(&self, validation: &HeaderMap) -> HeaderMap {
|
||||
let mut merged = merge_revalidated_headers(&self.headers, validation);
|
||||
let public_etag = self.headers.get("etag").cloned();
|
||||
let public_etag = self.headers.get(::http::header::ETAG).cloned();
|
||||
let representation_etag_differs = public_etag.as_ref().is_some_and(|public| {
|
||||
self.origin_etag
|
||||
.as_ref()
|
||||
@@ -289,7 +290,7 @@ impl Revalidation {
|
||||
});
|
||||
if representation_etag_differs {
|
||||
if let Some(public) = public_etag {
|
||||
merged.insert("etag", public);
|
||||
merged.insert(::http::header::ETAG, public);
|
||||
}
|
||||
}
|
||||
merged
|
||||
@@ -316,7 +317,7 @@ impl Revalidation {
|
||||
}
|
||||
fn vary_names(headers: &HeaderMap) -> Option<Vec<String>> {
|
||||
let mut names = Vec::new();
|
||||
for value in headers.get_all("vary") {
|
||||
for value in headers.get_all(::http::header::VARY) {
|
||||
for raw in value.to_str().ok()?.split(',') {
|
||||
let raw = raw.trim();
|
||||
if raw.is_empty() || raw == "*" {
|
||||
|
||||
Vendored
+1
-1
@@ -77,7 +77,7 @@ fn retention_deadline(
|
||||
}
|
||||
|
||||
fn has_validator(headers: &HeaderMap) -> bool {
|
||||
headers.contains_key("etag") || headers.contains_key("last-modified")
|
||||
headers.contains_key(::http::header::ETAG) || headers.contains_key(::http::header::LAST_MODIFIED)
|
||||
}
|
||||
|
||||
fn stale_forbidden(must_revalidate: bool, proxy_revalidate: bool) -> bool {
|
||||
|
||||
Reference in new issue
Block a user