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
+21
-13
@@ -9,9 +9,8 @@ use crate::{
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::{Request, State},
|
||||
middleware::{self, Next},
|
||||
response::{IntoResponse, Response},
|
||||
Extension, Router,
|
||||
Router,
|
||||
};
|
||||
use body::{Direction, Exchange, ExchangeSource, MeteredBody};
|
||||
use bytes::Bytes;
|
||||
@@ -49,14 +48,23 @@ use std::{
|
||||
};
|
||||
|
||||
pub fn router(state: Arc<App>) -> Router {
|
||||
Router::new()
|
||||
.fallback(forward)
|
||||
.layer(middleware::from_fn_with_state(state.clone(), observe))
|
||||
.layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
crate::acme::challenge,
|
||||
))
|
||||
.with_state(state)
|
||||
Router::new().fallback(entry).with_state(state)
|
||||
}
|
||||
|
||||
async fn entry(State(state): State<Arc<App>>, request: Request) -> Response {
|
||||
if crate::acme::is_challenge_path(request.uri().path()) {
|
||||
return crate::acme::challenge(state, request).await;
|
||||
}
|
||||
observe(state, request).await
|
||||
}
|
||||
|
||||
async fn dispatch(state: Arc<App>, request: Request) -> Response {
|
||||
let peer = request.extensions().get::<PeerAddr>().copied();
|
||||
let local = request.extensions().get::<LocalAddr>().copied();
|
||||
let (Some(peer), Some(local)) = (peer, local) else {
|
||||
return (StatusCode::INTERNAL_SERVER_ERROR, "Missing request extension").into_response();
|
||||
};
|
||||
forward(state, peer, local, request).await
|
||||
}
|
||||
const MAX_UPSTREAM_ERROR_DETAIL: usize = 2048;
|
||||
|
||||
@@ -320,7 +328,7 @@ async fn refresh_cache_once(
|
||||
.as_ref()
|
||||
.is_some_and(|settings| settings.enabled)
|
||||
{
|
||||
refresh_headers.remove("accept-encoding");
|
||||
refresh_headers.remove(::http::header::ACCEPT_ENCODING);
|
||||
}
|
||||
let mut refresh = Request::new(Body::empty());
|
||||
*refresh.method_mut() = Method::GET;
|
||||
@@ -382,8 +390,8 @@ async fn refresh_cache_once(
|
||||
let origin_no_transform = crate::transform::no_transform(origin.headers());
|
||||
let skip_compression = crate::compression::no_transform(origin.headers());
|
||||
let origin_validators = crate::transform::OriginValidators {
|
||||
etag: origin.headers().get("etag").cloned(),
|
||||
last_modified: origin.headers().get("last-modified").cloned(),
|
||||
etag: origin.headers().get(::http::header::ETAG).cloned(),
|
||||
last_modified: origin.headers().get(::http::header::LAST_MODIFIED).cloned(),
|
||||
};
|
||||
let (mut parts, body) = origin.into_parts();
|
||||
parts.extensions.insert(origin_validators);
|
||||
|
||||
Reference in new issue
Block a user