0.34.6_repo_cleanup

This commit is contained in:
Mateusz Gruszczyński committed 2026-10-22 09:31:15 +02:00
1 parent ce1a90397c
commit 133d2f0f91
273 files changed
+5969 -6926

No files matched your search

-12
View File
@@ -8,8 +8,6 @@ struct InternalFallbackRoute {
#[derive(Clone)]
struct FinalRouteContext(Arc<crate::config::CompiledRoute>);
/// The named location has already produced the terminal HTTP response.
/// In particular, do not replace its 404 HTML with a global/vhost error page.
#[derive(Clone, Copy)]
struct ErrorFallbackResponse;
@@ -93,11 +91,6 @@ async fn prepare_error_fallback_body(request: &mut Request, enabled: bool) -> Re
return Ok(ErrorFallbackBody::Replayable(Bytes::new()));
}
let Some(length) = request.body().size_hint().exact() else {
// HTTP/2 and HTTP/3 frequently expose an *empty* GET/HEAD body as a
// stream with no exact size hint. Refusing to inspect that stream
// silently disables the configured 404 fallback. Only peek for safe
// bodyless methods; an actual payload is replayed back into the
// original request and is never discarded or forwarded twice.
if request.method() == Method::GET || request.method() == Method::HEAD {
return match empty_for_cache(request).await {
Ok(true) => Ok(ErrorFallbackBody::Replayable(Bytes::new())),
@@ -183,16 +176,11 @@ async fn execute_error_fallback(
Some(response)
}
/// Called only for a response supplied by the Web Server or an HTTP origin.
/// Routing/security failures and internal fallback responses are excluded.
fn intercept_route_origin_error(
response: Response,
route: &crate::config::CompiledRoute,
snapshot: &crate::config::Snapshot,
) -> Response {
// An internal named location is the final, administrator-selected fallback
// representation. Interception inside its nested forward_request would
// otherwise erase its 404 HTML before ErrorFallbackResponse is attached.
if route.internal {
return response;
}