From: Felix Ableitner <me@nutomic.com>
Date: Fri, 12 Nov 2021 23:03:44 +0000 (+0100)
Subject: Make http signature compatible with mastodon
X-Git-Url: http://these/git/readmes/%7B%60%24%7BwebArchiveUrl%7D/save/static/README.es.md?a=commitdiff_plain;h=dc416bf2551b2da3fc3dc2ad03f2710479d5a9f1;p=lemmy.git

Make http signature compatible with mastodon
---

diff --git a/crates/apub_lib/src/signatures.rs b/crates/apub_lib/src/signatures.rs
index 3329b681..1e45a3e6 100644
--- a/crates/apub_lib/src/signatures.rs
+++ b/crates/apub_lib/src/signatures.rs
@@ -44,10 +44,9 @@ pub async fn sign_and_send(
     HeaderValue::from_str(APUB_JSON_CONTENT_TYPE)?,
   );
   headers.insert(HeaderName::from_str("Host")?, HeaderValue::from_str(&host)?);
-  headers.insert(
-    HeaderName::from_str("Date")?,
-    HeaderValue::from_str(&Utc::now().to_rfc2822())?,
-  );
+  // Need to use legacy timezone because mastodon and doesnt understand any new standards
+  let date = Utc::now().to_rfc2822().replace("+0000", "GMT");
+  headers.insert(HeaderName::from_str("Date")?, HeaderValue::from_str(&date)?);
 
   let response = client
     .post(&inbox_url.to_string())