forked from alemi/upub
fix: send empty digest rather than digest of ""
maybe fixes iceshrimp? maybe breaks everyone else??
This commit is contained in:
parent
1d19b8c2a6
commit
e96b778392
1 changed files with 4 additions and 2 deletions
|
@ -33,8 +33,10 @@ pub trait Fetcher {
|
||||||
let host = Context::server(url);
|
let host = Context::server(url);
|
||||||
let date = chrono::Utc::now().format("%a, %d %b %Y %H:%M:%S GMT").to_string(); // lmao @ "GMT"
|
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 path = url.replace("https://", "").replace("http://", "").replace(&host, "");
|
||||||
let payload_buf = payload.unwrap_or("").as_bytes();
|
let digest = match payload {
|
||||||
let digest = format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(payload_buf)));
|
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 = vec!["(request-target)", "host", "date", "digest"];
|
||||||
let headers_map : BTreeMap<String, String> = [
|
let headers_map : BTreeMap<String, String> = [
|
||||||
|
|
Loading…
Reference in a new issue