WEB: Base Path added

This commit is contained in:
Alexey
2026-09-26 13:49:28 +03:00
parent 326c0ecdb9
commit 5feded2919
32 changed files with 1094 additions and 125 deletions
+15 -2
View File
@@ -49,11 +49,18 @@ mod recovery_tests;
// Decoy fast-track routing and telemetry remain isolated from carrier protocol scenarios.
#[path = "decoy_fasttrack_tests.rs"]
mod decoy_fasttrack_tests;
// Base-path routing and credential containment share reference-contract coverage.
#[path = "base_path_tests.rs"]
mod base_path_tests;
// Raw response parsing helpers are shared by the HTTP integration test modules.
#[path = "response_test_support.rs"]
mod response_test_support;
// Alternate runtime fixtures remain separate from the main integration scenarios.
#[path = "runtime_test_support.rs"]
mod runtime_test_support;
pub(super) use response_test_support::{response_header, split_response};
pub(super) use runtime_test_support::runtime_config_with_base;
const TEST_CARRIER_DEADLINES_SECS: [u64; 4] = [3, 5, 8, 12];
@@ -86,6 +93,7 @@ fn runtime_config_with_carriers(
carrier_learning,
carriers,
TEST_CARRIER_DEADLINES_SECS,
"/",
)
}
@@ -104,6 +112,7 @@ pub(super) fn negotiation_runtime_config_with_deadlines(
carrier_learning,
carriers,
carrier_negotiation_deadlines_secs,
"/",
)
}
@@ -114,6 +123,7 @@ fn runtime_config_with_carriers_and_deadlines(
carrier_learning: bool,
carriers: Arc<[WebCarrier]>,
carrier_negotiation_deadlines_secs: [u64; 4],
base: &str,
) -> ProxyConfig {
let profile = Arc::new(WebRuntimeProfile {
host: "proxy.example.com".to_string(),
@@ -147,6 +157,7 @@ fn runtime_config_with_carriers_and_deadlines(
});
let vhost = Arc::new(WebRuntimeVhost {
host: "proxy.example.com".to_string(),
base: base.to_string(),
decoy_fasttrack_mode: WebDecoyFastTrackMode::Off,
decoy: WebRuntimeDecoy::StaticDirectory(Arc::clone(&site)),
decoy_header_secs: 1,
@@ -159,6 +170,7 @@ fn runtime_config_with_carriers_and_deadlines(
"other.example.com".to_string(),
Arc::new(WebRuntimeVhost {
host: "other.example.com".to_string(),
base: "/".to_string(),
decoy_fasttrack_mode: WebDecoyFastTrackMode::Off,
decoy: WebRuntimeDecoy::StaticDirectory(site),
decoy_header_secs: 1,
@@ -181,6 +193,7 @@ fn runtime_config_with_carriers_and_deadlines(
config.web.runtime = Some(Arc::new(WebRuntimeConfig {
vhosts,
profiles: vec![profile],
capabilities: vec![capability].into_boxed_slice(),
}));
config
}
@@ -328,12 +341,12 @@ async fn rejected_bridge_bootstrap_falls_back_to_uncacheable_static_index() {
let fallback_response = request(&listener, &runtime, bridge_request()).await;
let (fallback_headers, fallback_body) = split_response(&fallback_response);
assert!(fallback_headers.starts_with(b"HTTP/1.1 200"));
assert!(fallback_headers.starts_with(b"HTTP/1.1 404"));
assert_eq!(
response_header(fallback_headers, "cache-control"),
"no-store"
);
assert_eq!(fallback_body, b"<!doctype html><title>decoy</title>");
assert_eq!(fallback_body, b"not found\n");
runtime.shutdown().await;
generation.stop_sessions().await;