fix(mcp): repair HTTP service startup and simplify settings
This commit is contained in:
18 files changed
+62
-70
No files matched your search
@@ -326,6 +326,7 @@ mod tests {
|
||||
assert!(!auth.host_is_allowed(&uri, &headers));
|
||||
assert!(parse_host_rule("https://dbx.example.test").is_err());
|
||||
assert!(parse_host_rule("user@dbx.example.test:4224").is_err());
|
||||
assert!(parse_host_rule("[::1]").is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -108,9 +108,13 @@ impl RuntimeConfig {
|
||||
}
|
||||
|
||||
let token = http_token_from_environment()?;
|
||||
let auth = HttpAuth::new(token, allowed_origins.clone(), is_loopback)?;
|
||||
let allowed_hosts =
|
||||
if is_loopback { vec!["localhost".into(), "127.0.0.1".into(), "::1".into()] } else { allowed_hosts };
|
||||
let allowed_hosts = if is_loopback {
|
||||
// HTTP Host authorities require brackets around IPv6 literals.
|
||||
vec!["localhost".into(), "127.0.0.1".into(), "[::1]".into()]
|
||||
} else {
|
||||
allowed_hosts
|
||||
};
|
||||
let auth = HttpAuth::new_with_hosts(Some(token), allowed_hosts.clone(), allowed_origins.clone(), is_loopback)?;
|
||||
|
||||
Ok(Self { transport, http: Some(HttpRuntimeConfig { bind_addr, path, auth, allowed_hosts }) })
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user