v0.25.3
This commit is contained in:
1 parent
174389e5b1
commit
e6604e41fc
73 files changed
+1240
-201
No files matched your search
@@ -120,6 +120,23 @@ fn error(status: StatusCode, message: &'static str) -> Response {
|
||||
response
|
||||
}
|
||||
|
||||
fn method_policy_denial(
|
||||
policy: &crate::vhost::MethodPolicy,
|
||||
method: &Method,
|
||||
) -> Option<Response> {
|
||||
if policy.allows(method) {
|
||||
return None;
|
||||
}
|
||||
let mut response = error(
|
||||
StatusCode::METHOD_NOT_ALLOWED,
|
||||
"RustProxy: HTTP method denied by access policy\n",
|
||||
);
|
||||
if let Some(value) = policy.allow_header() {
|
||||
response.headers_mut().insert(http::header::ALLOW, value);
|
||||
}
|
||||
Some(response)
|
||||
}
|
||||
|
||||
fn local_location_response(spec: &crate::vhost::LocationResponse, method: &Method) -> Response {
|
||||
let status = StatusCode::from_u16(spec.status).unwrap_or(StatusCode::INTERNAL_SERVER_ERROR);
|
||||
let body_allowed = !matches!(status.as_u16(), 100..=199 | 204 | 304) && *method != Method::HEAD;
|
||||
@@ -211,7 +228,7 @@ fn finish_headers(
|
||||
frontend: Option<&crate::config::CompiledFrontend>,
|
||||
local: Option<std::net::SocketAddr>,
|
||||
tls: bool,
|
||||
id: u64,
|
||||
request_id: &str,
|
||||
active: &[crate::vhost::Listener],
|
||||
) {
|
||||
if let Some(frontend) = frontend {
|
||||
@@ -224,7 +241,7 @@ fn finish_headers(
|
||||
frontend
|
||||
.map(|f| &f.diagnostic_headers)
|
||||
.unwrap_or(&snapshot.envelope.config.diagnostic_headers)
|
||||
.apply(response.headers_mut(), id);
|
||||
.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(
|
||||
|
||||
Reference in new issue
Block a user