[tests] Diff: the differential suite runs on Windows too (Windows Caddy, drive paths), with two branch previews in the fixtures; edge leaves a websocket 101 as the upstream sent it, as Caddy does

This commit is contained in:
2026-11-17 13:59:18 +01:00
parent acf69a8ed2
commit 5e273241e4
6 changed files with 114 additions and 25 deletions
+9
View File
@@ -180,6 +180,15 @@ pub fn server(shared: Arc<Shared>, opts: &Options) -> Result<Server, EdgeError>
Ok(server)
}
/// For running edge inside a test process on Windows (the differential suite with Windows
/// paths, T4). Pingora on Windows stops only on Ctrl-C, so `stop` is ignored and the server
/// lives until the test process ends. Ianitor does not ship edge on Windows (Caddy mode).
#[cfg(windows)]
pub fn run_until(server: Server, stop: tokio::sync::oneshot::Receiver<()>) {
drop(stop);
server.run(pingora::server::RunArgs::default());
}
/// Run until `stop` resolves (or is dropped). For running edge inside a test process.
#[cfg(unix)]
pub fn run_until(server: Server, stop: tokio::sync::oneshot::Receiver<()>) {
+13 -8
View File
@@ -391,15 +391,20 @@ impl ProxyHttp for EdgeProxy {
ctx: &mut Ctx,
) -> Result<()> {
let Some(host) = &ctx.host else { return Ok(()) };
apply(&host.response_ops, |n, v| {
match v {
Some(v) => resp.insert_header(n.clone(), v.clone())?,
None => {
resp.remove_header(n);
// Response rules are for HTTP answers, not the switch to a websocket: Caddy leaves a
// `101` as the upstream sent it, and so does edge (found by the T4 preview fixture in
// the differential suite: `X-Robots-Tag` on a websocket upgrade).
if resp.status.as_u16() != 101 {
apply(&host.response_ops, |n, v| {
match v {
Some(v) => resp.insert_header(n.clone(), v.clone())?,
None => {
resp.remove_header(n);
}
}
}
Ok(())
})?;
Ok(())
})?;
}
// Defence in depth: never hand a secret back to a client, even if the upstream echoes it.
if !host.secret_values.is_empty() {
let leaking: Vec<http::HeaderName> = resp