Created
October 8, 2025 01:24
-
-
Save xeioex/17bde066f5b40c02312e08da7e29d38c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/acme.rs b/src/acme.rs | |
| index 6876326..d0d9dd5 100644 | |
| --- a/src/acme.rs | |
| +++ b/src/acme.rs | |
| @@ -18,7 +18,7 @@ use ngx::collections::Vec; | |
| use ngx::ngx_log_debug; | |
| use openssl::pkey::{PKey, PKeyRef, Private}; | |
| use openssl::x509::{self, extension as x509_ext, X509Req}; | |
| -use types::{AccountStatus, ProblemCategory}; | |
| +use types::AccountStatus; | |
| use self::account_key::{AccountKey, AccountKeyError}; | |
| use self::types::{AuthorizationStatus, ChallengeKind, ChallengeStatus, OrderStatus}; | |
| @@ -423,12 +423,7 @@ where | |
| res = x; | |
| order = deserialize_body(res.body())?; | |
| } | |
| - Err(RequestError::Protocol(problem)) | |
| - if matches!( | |
| - problem.category(), | |
| - ProblemCategory::Order | ProblemCategory::Malformed | |
| - ) => | |
| - { | |
| + Err(RequestError::Protocol(problem)) if problem.is_order_related() => { | |
| return Err(problem.into()) | |
| } | |
| _ => order.status = OrderStatus::Processing, | |
| diff --git a/src/acme/error.rs b/src/acme/error.rs | |
| index c7fd3c8..cff0d4b 100644 | |
| --- a/src/acme/error.rs | |
| +++ b/src/acme/error.rs | |
| @@ -10,7 +10,7 @@ use ngx::allocator::{unsize_box, Box}; | |
| use thiserror::Error; | |
| use super::solvers::SolverError; | |
| -use super::types::{self, Problem, ProblemCategory}; | |
| +use super::types::{self, Problem}; | |
| use crate::net::http::HttpClientError; | |
| #[derive(Debug, Error)] | |
| @@ -47,10 +47,7 @@ impl NewAccountError { | |
| pub fn is_invalid(&self) -> bool { | |
| match self { | |
| Self::ExternalAccount => true, | |
| - Self::Protocol(err) => matches!( | |
| - err.category(), | |
| - ProblemCategory::Account | ProblemCategory::Malformed | |
| - ), | |
| + Self::Protocol(err) => err.is_account_related(), | |
| Self::Status(_) => true, | |
| _ => false, | |
| } | |
| @@ -105,10 +102,7 @@ impl From<RequestError> for NewCertificateError { | |
| impl NewCertificateError { | |
| pub fn is_invalid(&self) -> bool { | |
| match self { | |
| - Self::Protocol(err) => matches!( | |
| - err.category(), | |
| - ProblemCategory::Order | ProblemCategory::Malformed | |
| - ), | |
| + Self::Protocol(err) => err.is_order_related(), | |
| _ => false, | |
| } | |
| } | |
| diff --git a/src/acme/types.rs b/src/acme/types.rs | |
| index 7889e59..ef80f3b 100644 | |
| --- a/src/acme/types.rs | |
| +++ b/src/acme/types.rs | |
| @@ -355,6 +355,20 @@ impl Problem { | |
| _ => ProblemCategory::Other, | |
| } | |
| } | |
| + | |
| + pub fn is_order_related(&self) -> bool { | |
| + matches!( | |
| + self.category(), | |
| + ProblemCategory::Order | ProblemCategory::Malformed | |
| + ) | |
| + } | |
| + | |
| + pub fn is_account_related(&self) -> bool { | |
| + matches!( | |
| + self.category(), | |
| + ProblemCategory::Account | ProblemCategory::Malformed | |
| + ) | |
| + } | |
| } | |
| fn deserialize_vec_of_uri<'de, D>(deserializer: D) -> Result<Vec<Uri>, D::Error> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment