This commit is contained in:
asonix 2022-11-22 18:15:50 -06:00
parent efc55fd9a1
commit 92a6f53dd6
2 changed files with 9 additions and 11 deletions

View file

@ -504,7 +504,7 @@ impl Config {
let unsigned = self let unsigned = self
.config .config
.begin_sign(&method.to_string(), &path_and_query, headers)?; .begin_sign(method.as_ref(), &path_and_query, headers)?;
Ok(self::create::Unsigned { unsigned }) Ok(self::create::Unsigned { unsigned })
} }
@ -528,7 +528,7 @@ impl Config {
let unverified = self let unverified = self
.config .config
.begin_verify(&method.to_string(), &path_and_query, headers)?; .begin_verify(method.as_ref(), &path_and_query, headers)?;
Ok(unverified) Ok(unverified)
} }

View file

@ -67,15 +67,13 @@ where
E: From<JoinError> + From<PrepareSignError> + std::fmt::Debug + Send + 'static, E: From<JoinError> + From<PrepareSignError> + std::fmt::Debug + Send + 'static,
K: Display, K: Display,
{ {
if config.set_date { if config.set_date && !request.headers().contains_key("date") {
if !request.headers().contains_key("date") { request.headers_mut().insert(
request.headers_mut().insert( actix_http::header::DATE,
actix_http::header::DATE, HttpDate::from(SystemTime::now())
HttpDate::from(SystemTime::now()) .try_into_value()
.try_into_value() .expect("Date is valid"),
.expect("Date is valid"), );
);
}
} }
let mut headers = request.headers().clone(); let mut headers = request.headers().clone();