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

-19
View File
@@ -1,5 +1,4 @@
{
// Only a real cache revalidation needs origin headers after response rules.
let origin_validation_headers = if revalidation_sent
&& response.status() == StatusCode::NOT_MODIFIED
{
@@ -112,9 +111,6 @@ if handshake.as_ref().is_some_and(|handshake| {
"RustProxy: HTTP/1.1 WebSocket upstream returned 2xx without switching protocols\n",
);
}
// Varnish built-in behavior treats non-GET/HEAD methods as pass: the
// response is never stored, but existing cached GET representations are
// not purged implicitly. Explicit cache purge remains an admin action.
let origin_plan = if cache_ticket.is_some()
&& !(ignore_static_cookie && crate::cache::varies_on(response.headers(), "cookie"))
{
@@ -181,9 +177,6 @@ let mut response = if h3_tunnel {
"RustProxy: WebSocket exchange state unavailable\n",
);
};
// Hyper cannot complete the client-side upgrade while the 101 body
// remains owned here. Drop it, then prove that OnUpgrade is ready
// BEFORE returning a successful RFC 9220 response to the H3 layer.
drop(body);
let stop_token = stop
.as_ref()
@@ -213,8 +206,6 @@ let mut response = if h3_tunnel {
}
};
exchange.websocket_phase("tunnel_ready");
// RFC 8441/9220 uses a successful 2xx response, never 101, and
// Sec-WebSocket-Accept is not part of the downstream handshake.
parts.status = StatusCode::OK;
parts.headers.remove("sec-websocket-accept");
parts.headers.remove("content-length");
@@ -338,21 +329,11 @@ let mut response = if h3_tunnel {
}
Response::from_parts(parts, Body::new(body))
};
// The upstream HTTP client returns Response<hyper::body::Incoming>. Adapt it
// before rendering a RustProxy error page, so HTTP/2 WebSocket tunnels can
// continue using the original Incoming body without type erasure.
// An internal named-location fallback has already won earlier in response.rs.
let intercept_origin_error = !route.internal && route.frontend.as_ref().is_some_and(|frontend| {
frontend.pages.intercept_statuses.contains(&response.status().as_u16())
});
// Mark every upstream response as application-supplied, even if this vhost
// does not intercept its status. The observer must not overwrite it merely
// because a global 404/5xx error page exists.
response = intercept_route_origin_error(response, route, &snapshot);
if intercept_origin_error {
// The earlier response rules modified the original origin headers;
// reapply them to the newly rendered page so the vhost's header policy
// remains effective. Do not allow a custom header rule to cache errors.
apply_response_rules(
response.headers_mut(),
&snapshot,