forked from alemi/upub
fix: empty digest is rejected by mastodon, revert
This commit is contained in:
parent
7fa15a57a8
commit
8a36e91fde
1 changed files with 5 additions and 4 deletions
|
@ -33,10 +33,11 @@ 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 digest = match payload {
|
let digest = format!("sha-256={}",
|
||||||
Some(x) => format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(x.as_bytes()))),
|
base64::prelude::BASE64_STANDARD.encode(
|
||||||
None => "sha-256=".to_string(),
|
openssl::sha::sha256(payload.unwrap_or("").as_bytes())
|
||||||
};
|
)
|
||||||
|
);
|
||||||
|
|
||||||
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