From 2e8d4323ee1a358a1e8da0fbd04ad6b6d0bed52a Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 13 Apr 2024 21:35:53 +0200 Subject: [PATCH] fix: don't repeat (request-target) --- src/server/auth.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server/auth.rs b/src/server/auth.rs index d73ebab3..b820e685 100644 --- a/src/server/auth.rs +++ b/src/server/auth.rs @@ -132,9 +132,14 @@ impl HttpSignature { pub fn build_manually(&mut self, method: &str, target: &str, mut headers: BTreeMap) -> &mut Self { let mut out = Vec::new(); - out.push(format!("(request-target): {method} {target}")); for header in &self.headers { - out.push(format!("{header}: {}", headers.remove(header).unwrap_or_default())); + match header.as_str() { + "(request-target)" => out.push(format!("(request-target): {method} {target}")), + // TODO other pseudo-headers + _ => out.push( + format!("{header}: {}", headers.remove(header).unwrap_or_default()) + ), + } } self.control = out.join("\n"); self