v0.34.0_10
This commit is contained in:
1 parent
8c4cbc583f
commit
dd2502dd11
13 files changed
+389
-113
No files matched your search
+28
-12
@@ -157,27 +157,43 @@ fn encoded_origin_path(path: &str) -> Option<String> {
|
||||
fn response_context(
|
||||
snapshot: &crate::config::Snapshot,
|
||||
request: &Request,
|
||||
) -> (
|
||||
Option<Arc<crate::config::CompiledFrontend>>,
|
||||
Option<Arc<crate::config::CompiledRoute>>,
|
||||
) {
|
||||
) -> SelectedRouteContext {
|
||||
let tls = request
|
||||
.extensions()
|
||||
.get::<Transport>()
|
||||
.copied()
|
||||
.unwrap_or_default()
|
||||
.tls;
|
||||
let context = (|| {
|
||||
let selected = (|| {
|
||||
let local = request.extensions().get::<LocalAddr>()?.0;
|
||||
let authority = effective_host(request, tls).ok()?;
|
||||
let host = request_host(authority.to_str().ok()?).ok()?;
|
||||
let original_host = effective_host(request, tls).ok()?;
|
||||
let host = request_host(original_host.to_str().ok()?).ok()?;
|
||||
let frontend = snapshot.frontend(&host, local, tls).cloned();
|
||||
let route = crate::acl::routing_path_view(request.uri().path())
|
||||
.ok()
|
||||
.and_then(|path| snapshot.select_on_arc(&host, path.as_ref(), local, tls).cloned());
|
||||
Some((frontend, route))
|
||||
let path = crate::acl::routing_path_view(request.uri().path()).ok();
|
||||
let route = path.as_ref().and_then(|path| {
|
||||
snapshot.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),
|
||||
});
|
||||
Some(SelectedRouteContext {
|
||||
frontend,
|
||||
route,
|
||||
validated: Some(ValidatedRoutingIdentity {
|
||||
original_host,
|
||||
host,
|
||||
decoded_path,
|
||||
}),
|
||||
})
|
||||
})();
|
||||
context.unwrap_or((None, None))
|
||||
selected.unwrap_or(SelectedRouteContext {
|
||||
frontend: None,
|
||||
route: None,
|
||||
validated: None,
|
||||
})
|
||||
}
|
||||
|
||||
/// Reserved administration-session cookies may cross the proxy boundary only
|
||||
|
||||
Reference in new issue
Block a user