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

-38
View File
@@ -114,8 +114,6 @@ fn error(status: StatusCode, detail: &'static str) -> Response {
);
response
} else {
// For statuses without a built-in error page (405, 421, 501, ...),
// emit the HTTP status instead of implementation-specific diagnostics.
let body = format!(
"{} {}\n",
status.as_u16(),
@@ -188,8 +186,6 @@ fn response_context(snapshot: &crate::config::Snapshot, request: &Request) -> Se
.select_on_arc(&host, path.as_ref(), local, tls)
.cloned()
});
// An ordinary path borrows the original URI in forward_request. Only
// a decoded path needs to be moved between middleware and forwarding.
let decoded_path = path.and_then(|path| match path {
std::borrow::Cow::Borrowed(_) => None,
std::borrow::Cow::Owned(path) => Some(path),
@@ -211,11 +207,6 @@ fn response_context(snapshot: &crate::config::Snapshot, request: &Request) -> Se
})
}
/// Reserved administration-session cookies may cross the proxy boundary only
/// for the explicit self-admin deployment: HTTPS, a specifically allowed
/// administration hostname (extra DNS list or pinned public HTTPS origin),
/// a backend that directly targets the configured
/// administration listener, and the existing local-listener risk opt-in.
fn admin_session_passthrough(
snapshot: &crate::config::Snapshot,
host: &str,
@@ -263,7 +254,6 @@ fn apply_response_age_rules(
crate::headers::apply_wire_age(headers, &route.headers.response);
}
}
/// Final policies apply to cache hits, errors, static pages and ALL transports.
fn finish_headers(
response: &mut Response,
snapshot: &crate::config::Snapshot,
@@ -284,7 +274,6 @@ fn finish_headers(
.map(|f| &f.diagnostic_headers)
.unwrap_or(&snapshot.envelope.config.diagnostic_headers)
.apply(response.headers_mut(), request_id);
// Authenticated content must not leak through an external shared cache either.
if frontend.is_some_and(|f| f.tinyauth.is_some() || f.basic_auth.is_some()) {
response.headers_mut().insert(
"cache-control",
@@ -328,8 +317,6 @@ fn apply_timing_headers(
}
}
/// Opt-in backend diagnostics are applied after response rules and cache handling so
/// an origin cannot spoof them and a cache hit never reports a stale backend.
fn apply_backend_diagnostic_values(
response: &mut Response,
backend_header: bool,
@@ -367,8 +354,6 @@ fn apply_backend_diagnostic_headers(
frontend.is_some_and(|value| value.backend_timing_header),
);
}
/// Peek at one bounded frame when a multiplexed request has no exact size hint.
/// An absent Content-Length on HTTP/2 or HTTP/3 is NOT proof of an empty body.
async fn empty_for_cache(request: &mut Request) -> Result<bool, axum::Error> {
if request.body().is_end_stream() {
return Ok(true);
@@ -376,11 +361,6 @@ async fn empty_for_cache(request: &mut Request) -> Result<bool, axum::Error> {
if request.body().size_hint().lower() > 0 {
return Ok(false);
}
// Multiplexed transports may end a body with an empty DATA frame.
// On H3 document GET/HEAD, waiting without a bound can stall the entire
// cache/404-routing stage before proxy forwarding even starts. A timed
// probe that finds no FIN conservatively bypasses caching; it never drops
// or consumes a nonempty request body.
let bounded_h3_navigation = request.version() == Version::HTTP_3
&& (request.method() == Method::GET || request.method() == Method::HEAD);
for _ in 0..8 {
@@ -420,14 +400,6 @@ async fn empty_for_cache(request: &mut Request) -> Result<bool, axum::Error> {
Ok(false)
}
/// Resolve the framing ambiguity of an HTTP/3 request with no declared length
/// before handing it to an HTTP/1.1 upstream. Hyper encodes an unknown-length
/// HTTP/1.1 request as chunked for methods other than GET/HEAD/CONNECT. That is
/// correct HTTP/1.1, but an actually empty H3 stream can be represented more
/// precisely as a zero-length body once its end is observed.
///
/// Only the first semantically significant frame is inspected; non-empty bodies
/// remain streaming through ReplayBody and are never fully buffered.
async fn normalize_h3_h1_unknown_body(
request: &mut Request,
upstream_version: Version,
@@ -442,16 +414,6 @@ async fn normalize_h3_h1_unknown_body(
return Ok(());
}
// Ignore a small number of empty DATA frames while looking for either the
// stream end or the first frame that carries request semantics. The body
// idle timer in MeteredBody still bounds a stalled peer.
// A full page navigation (e.g. clicking the RustProxy logo) is a GET.
// H3 HEADERS can precede FIN on a document GET. Resolve the receive half
// when FIN arrives promptly, before handing the request to an H1 origin.
// Hyper already special-cases GET/HEAD H1 encoding; this probe targets
// receive-stream completion, not a presumed chunked GET on the wire.
// When the peer is slow or sends a real request body, retain streaming and
// do not delay navigation by the general upload/body-idle deadline.
let navigation_method = method == Method::GET || method == Method::HEAD;
for _ in 0..8 {
let next = if navigation_method {