From b15a7d3c0da91a58b7d30ff56e0350e117759be6 Mon Sep 17 00:00:00 2001 From: Ali MJ Al-Nasrawy Date: Fri, 28 Jan 2022 14:40:32 +0300 Subject: [PATCH] test for useless safe table --- actix-router/src/quoter.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/actix-router/src/quoter.rs b/actix-router/src/quoter.rs index 8a1e99e1d..5058cf652 100644 --- a/actix-router/src/quoter.rs +++ b/actix-router/src/quoter.rs @@ -241,4 +241,16 @@ mod tests { let q = Quoter::new(b"", b""); assert_eq!(q.requote(b"/abc/../efg"), None); } + + #[test] + fn pointless_safe_table() { + for safe_ch in 0..=127 { + let q = Quoter::new(&[safe_ch], b""); + + for i in 0..=255 { + let test = format!("/%{:02X}/", i); + assert_eq!(q.requote(test.as_bytes()).unwrap(), &[b'/', i, b'/']); + } + } + } }