[edge] Device certificates as Caddy does them: no certificate on a device host fails the handshake, a Host other than the SNI name is 421; diff corpus gains six device cases

This commit is contained in:
2026-11-07 22:55:37 +01:00
parent 3d8f524d00
commit a5190acc3b
7 changed files with 213 additions and 16 deletions
+6 -6
View File
@@ -140,7 +140,7 @@ mod unix {
}
#[tokio::test(flavor = "multi_thread")]
async fn no_certificate_is_a_403_and_never_reaches_the_upstream() {
async fn no_certificate_is_refused_and_never_reaches_the_upstream() {
let echo = Echo::start("app").await;
let p = pki();
let (_, phone_pem) = device(&p, "phone");
@@ -151,11 +151,11 @@ mod unix {
edge.roots(),
&Req::get("locked.test", "/"),
)
.await
.unwrap();
assert_eq!(r.status, 403);
.await;
assert!(r.is_err(), "no certificate got in: {r:?}");
assert!(echo.requests().is_empty());
// The Host header cannot move a certificate-less connection onto the locked host.
// The Host header cannot move a certificate-less connection onto the locked host:
// 421, as Caddy answers once client certificates are configured.
let r = client::https(
edge.https,
"open.test",
@@ -164,7 +164,7 @@ mod unix {
)
.await
.unwrap();
assert_ne!(r.status, 200);
assert_eq!(r.status, 421);
assert!(echo.requests().is_empty());
}