0.34.6_repo_cleanup
This commit is contained in:
1 parent
ce1a90397c
commit
133d2f0f91
273 files changed
+5969
-6926
No files matched your search
@@ -1,7 +1,5 @@
|
||||
include!("request_id.rs");
|
||||
include!("request_id/mod.rs");
|
||||
|
||||
// Retain the exchange through the response, but do not allocate an additional
|
||||
// body adapter for a request whose body has no frames or trailers.
|
||||
fn wrap_observed_request(body: Body, exchange: &Arc<Exchange>, idle: Duration) -> Body {
|
||||
if body.is_end_stream() {
|
||||
body
|
||||
@@ -48,8 +46,6 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
let selected = response_context(&snapshot, &request);
|
||||
let frontend_context = selected.frontend.clone();
|
||||
let route_context = selected.route.clone();
|
||||
// The same validated request identity and snapshot are transferred to
|
||||
// forward(); no second hostname parsing or encoded-path decoding.
|
||||
request.extensions_mut().insert(selected);
|
||||
let local = request.extensions().get::<LocalAddr>().map(|v| v.0);
|
||||
let transport_tls = request
|
||||
@@ -200,9 +196,6 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
h3_reset_code: Mutex::new(None),
|
||||
upstream_status: AtomicU16::new(0),
|
||||
upstream_error: Mutex::new(None),
|
||||
// Always log at least the transport peer. `forward` replaces this with
|
||||
// the verified effective client address after trusted-proxy/Cloudflare
|
||||
// processing, so policy and live-log identity remain aligned.
|
||||
client_ip: Mutex::new(initial_client_ip),
|
||||
user_agent,
|
||||
country: Mutex::new(None),
|
||||
@@ -251,9 +244,6 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
}
|
||||
}
|
||||
if minimal_welcome {
|
||||
// Keep the built-in "RustProxy is running" response intentionally
|
||||
// minimal. It is never cacheable and carries no optional RustProxy
|
||||
// diagnostics/server/security/compression/cache-diagnostic headers.
|
||||
for name in [
|
||||
"server",
|
||||
"server-timing",
|
||||
@@ -336,9 +326,6 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
);
|
||||
}
|
||||
let global_compression = &snapshot.envelope.config.compression;
|
||||
// All scoped policies have the global codec ceiling. With no accepted
|
||||
// global encoding (e.g. Accept-Encoding: identity), encode is a no-op:
|
||||
// avoid even constructing/resolving the per-request settings.
|
||||
if method != Method::HEAD
|
||||
&& crate::compression::preferred_encoding(&original_headers, global_compression)
|
||||
.is_some()
|
||||
@@ -437,13 +424,9 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
.get::<LocalGeneratedResponse>()
|
||||
.is_some()
|
||||
{
|
||||
// Static/placeholder/default pages are generated locally and must never
|
||||
// look cacheable or carry RustProxy cache diagnostics/validators.
|
||||
enforce_local_page_no_cache(&mut response);
|
||||
}
|
||||
if response.extensions().get::<LocalHostResponse>().is_some() {
|
||||
// 404 hosts are fully local and never participate in RustProxy caching.
|
||||
// Keep their wire response free of cache policy, validators and cache diagnostics.
|
||||
for name in [
|
||||
"cache-control",
|
||||
"age",
|
||||
@@ -490,8 +473,6 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
))
|
||||
})
|
||||
}
|
||||
/// HTTP/2 and HTTP/3 authority is a pseudo-header, not necessarily a Host field.
|
||||
/// HTTP/1 absolute-form remains forbidden: this is not a forward proxy.
|
||||
fn effective_host(request: &Request, tls: bool) -> Result<HeaderValue, ()> {
|
||||
let count = request.headers().get_all(HOST).iter().count();
|
||||
if matches!(request.version(), Version::HTTP_2 | Version::HTTP_3) {
|
||||
|
||||
Reference in new issue
Block a user