From e96b778392be7d078570bff534a151abe8950a65 Mon Sep 17 00:00:00 2001 From: alemi Date: Sat, 11 May 2024 19:19:42 +0200 Subject: [PATCH] fix: send empty digest rather than digest of "" maybe fixes iceshrimp? maybe breaks everyone else?? --- src/server/fetcher.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server/fetcher.rs b/src/server/fetcher.rs index 41029b11..d49c073e 100644 --- a/src/server/fetcher.rs +++ b/src/server/fetcher.rs @@ -33,8 +33,10 @@ pub trait Fetcher { let host = Context::server(url); let date = chrono::Utc::now().format("%a, %d %b %Y %H:%M:%S GMT").to_string(); // lmao @ "GMT" let path = url.replace("https://", "").replace("http://", "").replace(&host, ""); - let payload_buf = payload.unwrap_or("").as_bytes(); - let digest = format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(payload_buf))); + let digest = match payload { + Some(x) => format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(x.as_bytes()))), + None => "sha-256=".to_string(), + }; let headers = vec!["(request-target)", "host", "date", "digest"]; let headers_map : BTreeMap = [