Skip to content

Commit 2934b34

Browse files
committed
ACME: check supported challenges only for pending authorizations.
1 parent 4ae3078 commit 2934b34

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/acme.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,22 +379,22 @@ where
379379

380380
let order: types::Order = deserialize_body(res.body())?;
381381

382-
let mut authorizations: Vec<(http::Uri, types::Authorization)> = Vec::new();
382+
let mut pending_authorizations: Vec<(http::Uri, types::Authorization)> = Vec::new();
383383
for auth_url in order.authorizations {
384384
let res = self.post(&auth_url, b"").await?;
385385
let mut authorization: types::Authorization = deserialize_body(res.body())?;
386386

387-
authorization
388-
.challenges
389-
.retain(|x| self.is_supported_challenge(&x.kind));
390-
391-
if authorization.challenges.is_empty() {
392-
return Err(NewCertificateError::NoSupportedChallenges);
393-
}
394-
395387
match authorization.status {
396388
types::AuthorizationStatus::Pending => {
397-
authorizations.push((auth_url, authorization))
389+
authorization
390+
.challenges
391+
.retain(|x| self.is_supported_challenge(&x.kind));
392+
393+
if authorization.challenges.is_empty() {
394+
return Err(NewCertificateError::NoSupportedChallenges);
395+
}
396+
397+
pending_authorizations.push((auth_url, authorization))
398398
}
399399
types::AuthorizationStatus::Valid => {
400400
ngx_log_debug!(
@@ -415,7 +415,7 @@ where
415415
pkey: &pkey,
416416
};
417417

418-
for (url, authorization) in authorizations {
418+
for (url, authorization) in pending_authorizations {
419419
self.do_authorization(&order, url, authorization).await?;
420420
}
421421

0 commit comments

Comments
 (0)