mirror of
https://github.com/astro/buzzrelay.git
synced 2024-11-23 20:40:59 +00:00
fetch, send: use httpdate for formatting Date: header
> Oct 07 03:25:59 buzzrelay buzzrelay[676]: 2023-10-07T01:25:59.381211Z ERROR buzzrelay::relay: relay::send Response("{\"error\":\"Invalid Date header: not RFC 2616 compliant date: \\\"Sat, 7 Oct 2023 01:25:58 GMT\\\"\"}") is it the leading 0 in the day position?
This commit is contained in:
parent
33baca81d8
commit
712cc328e1
4 changed files with 6 additions and 5 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -283,6 +283,7 @@ dependencies = [
|
|||
"futures",
|
||||
"http",
|
||||
"http_digest_headers",
|
||||
"httpdate",
|
||||
"metrics",
|
||||
"metrics-exporter-prometheus",
|
||||
"metrics-util",
|
||||
|
|
|
@ -31,3 +31,4 @@ metrics-util = "0.15"
|
|||
metrics-exporter-prometheus = "0.12"
|
||||
deunicode = "1.3"
|
||||
urlencoding = "2"
|
||||
httpdate = "1"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use std::time::SystemTime;
|
||||
use http::StatusCode;
|
||||
use serde::de::DeserializeOwned;
|
||||
use sigh::{PrivateKey, SigningConfig, alg::RsaSha256};
|
||||
|
@ -21,8 +22,7 @@ where
|
|||
.uri(uri)
|
||||
.header("host", &host)
|
||||
.header("content-type", "application/activity+json")
|
||||
.header("date", chrono::Utc::now().to_rfc2822()
|
||||
.replace("+0000", "GMT"))
|
||||
.header("date", httpdate::fmt_http_date(SystemTime::now()))
|
||||
.header("accept", "application/activity+json")
|
||||
.header("digest", digest_header)
|
||||
.body(vec![])?;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
time::{Instant, SystemTime},
|
||||
};
|
||||
use http::StatusCode;
|
||||
use metrics::histogram;
|
||||
|
@ -39,8 +39,7 @@ pub async fn send_raw(
|
|||
.uri(uri)
|
||||
.header("host", &host)
|
||||
.header("content-type", "application/activity+json")
|
||||
.header("date", chrono::Utc::now().to_rfc2822()
|
||||
.replace("+0000", "GMT"))
|
||||
.header("date", httpdate::fmt_http_date(SystemTime::now()))
|
||||
.header("digest", digest_header)
|
||||
.body(body.as_ref().clone())
|
||||
.map_err(Error::HttpReq)?;
|
||||
|
|
Loading…
Reference in a new issue