Add Date header so the relay can actually make requests lmao

This commit is contained in:
asonix 2020-04-23 13:36:06 -05:00
parent d3e3a13997
commit 13a968aaa9

View file

@ -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(),