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

View file

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