diff --git a/src/server/fetcher.rs b/src/server/fetcher.rs index 41029b1..d49c073 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 = [