From 13a968aaa934e67b501c6c4de28b9d371610ecf5 Mon Sep 17 00:00:00 2001 From: asonix Date: Thu, 23 Apr 2020 13:36:06 -0500 Subject: [PATCH] Add Date header so the relay can actually make requests lmao --- src/requests.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/requests.rs b/src/requests.rs index 0db92ae..7a820dd 100644 --- a/src/requests.rs +++ b/src/requests.rs @@ -1,11 +1,12 @@ use crate::error::MyError; use activitystreams::primitives::XsdAnyUri; -use actix_web::client::Client; +use actix_web::{client::Client, http::header::Date}; use bytes::Bytes; use http_signature_normalization_actix::prelude::*; use log::{debug, info}; use rsa::{hash::Hashes, padding::PaddingScheme, RSAPrivateKey}; use sha2::{Digest, Sha256}; +use std::time::SystemTime; #[derive(Clone)] pub struct Requests { @@ -35,6 +36,7 @@ impl Requests { .client .get(url) .header("Accept", "application/activity+json") + .set(Date(SystemTime::now().into())) .signature( self.config.clone(), self.key_id.clone(), @@ -70,6 +72,7 @@ impl Requests { .client .get(url) .header("Accept", "*/*") + .set(Date(SystemTime::now().into())) .signature( self.config.clone(), self.key_id.clone(), @@ -124,6 +127,7 @@ impl Requests { .post(inbox.as_str()) .header("Accept", "application/activity+json") .header("Content-Type", "application/activity+json") + .set(Date(SystemTime::now().into())) .signature_with_digest( self.config.clone(), self.key_id.clone(),