[core] Format: rustfmt on the path and redaction changes

This commit is contained in:
2026-11-07 18:57:53 +01:00
parent 2b66729f1b
commit 54574702ea
3 changed files with 38 additions and 5 deletions
+30 -3
View File
@@ -406,9 +406,36 @@ pub fn check_prefix(prefix: &str) -> Result<String, &'static str> {
/// - fullwidth and look-alike dots and slashes that NFKC turns into `.` and `/`: U+FF0E,
/// U+FF0F, U+FF3C, U+FE52, U+2024, U+2215, U+2044, U+29F8.
pub const REFUSED_ENCODINGS: &[&str] = &[
"%2e", "%2f", "%5c", "%25", "%00", "%u", "%c0", "%c1", "%e0%8", "%e0%9", "%f0%8", "%f5",
"%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff", "%ef%bc%8e",
"%ef%bc%8f", "%ef%bc%bc", "%ef%b9%92", "%e2%80%a4", "%e2%88%95", "%e2%81%84", "%e2%a7%b8",
"%2e",
"%2f",
"%5c",
"%25",
"%00",
"%u",
"%c0",
"%c1",
"%e0%8",
"%e0%9",
"%f0%8",
"%f5",
"%f6",
"%f7",
"%f8",
"%f9",
"%fa",
"%fb",
"%fc",
"%fd",
"%fe",
"%ff",
"%ef%bc%8e",
"%ef%bc%8f",
"%ef%bc%bc",
"%ef%b9%92",
"%e2%80%a4",
"%e2%88%95",
"%e2%81%84",
"%e2%a7%b8",
];
/// Is `raw_path` (the request path exactly as sent, still percent-encoded) under `prefix`?
+4 -1
View File
@@ -795,7 +795,10 @@ mod shown_tests {
#[test]
fn userinfo_is_hidden() {
assert_eq!(shown_url("http://user:hunter2@10.0.0.1:80/x"), "http://\u{2026}@10.0.0.1:80/x");
assert_eq!(
shown_url("http://user:hunter2@10.0.0.1:80/x"),
"http://\u{2026}@10.0.0.1:80/x"
);
assert_eq!(shown_url("user:hunter2@host:80"), "\u{2026}@host:80");
assert_eq!(shown_url("http://10.0.0.1:80"), "http://10.0.0.1:80");
assert_eq!(shown_url("http://h/a@b"), "http://h/a@b");
+4 -1
View File
@@ -249,6 +249,9 @@ fn a_password_in_an_upstream_url_is_never_repeated() {
let all = format!("{e} {:?} {:?}", e.params(), e.field());
assert!(!all.contains("hunter2"), "{all}");
}
let e = errs.iter().find(|e| e.code() == "host.upstream.credentials").unwrap();
let e = errs
.iter()
.find(|e| e.code() == "host.upstream.credentials")
.unwrap();
assert_eq!(e.params()["url"], "http://\u{2026}@10.0.0.2:3000");
}