From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id C0D5D1FF141 for ; Fri, 16 Jan 2026 12:29:07 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9372517614; Fri, 16 Jan 2026 12:29:11 +0100 (CET) From: Samuel Rufinatscha To: pbs-devel@lists.proxmox.com Date: Fri, 16 Jan 2026 12:28:56 +0100 Message-ID: <20260116112859.194016-3-s.rufinatscha@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260116112859.194016-1-s.rufinatscha@proxmox.com> References: <20260116112859.194016-1-s.rufinatscha@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1768562898225 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.246 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox v6 2/3] acme: introduce http_status module X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Introduce an internal http_status module with the common ACME HTTP response codes, and replace use of crate::request::CREATED as well as direct numeric status code usages. Signed-off-by: Samuel Rufinatscha --- proxmox-acme/src/account.rs | 8 ++++---- proxmox-acme/src/async_client.rs | 4 ++-- proxmox-acme/src/lib.rs | 2 ++ proxmox-acme/src/request.rs | 11 ++++++++++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/proxmox-acme/src/account.rs b/proxmox-acme/src/account.rs index f763c1e9..c62e60e0 100644 --- a/proxmox-acme/src/account.rs +++ b/proxmox-acme/src/account.rs @@ -85,7 +85,7 @@ impl Account { method: "POST", content_type: crate::request::JSON_CONTENT_TYPE, body, - expected: crate::request::CREATED, + expected: crate::http_status::CREATED, }; Ok(NewOrder::new(request)) @@ -107,7 +107,7 @@ impl Account { method: "POST", content_type: crate::request::JSON_CONTENT_TYPE, body, - expected: 200, + expected: crate::http_status::OK, }) } @@ -132,7 +132,7 @@ impl Account { method: "POST", content_type: crate::request::JSON_CONTENT_TYPE, body, - expected: 200, + expected: crate::http_status::OK, }) } @@ -405,7 +405,7 @@ impl AccountCreator { method: "POST", content_type: crate::request::JSON_CONTENT_TYPE, body, - expected: crate::request::CREATED, + expected: crate::http_status::CREATED, }) } diff --git a/proxmox-acme/src/async_client.rs b/proxmox-acme/src/async_client.rs index dc755fb9..c803823d 100644 --- a/proxmox-acme/src/async_client.rs +++ b/proxmox-acme/src/async_client.rs @@ -498,7 +498,7 @@ impl AcmeClient { method: "GET", content_type: "", body: String::new(), - expected: 200, + expected: crate::http_status::OK, }, nonce, ) @@ -550,7 +550,7 @@ impl AcmeClient { method: "HEAD", content_type: "", body: String::new(), - expected: 200, + expected: crate::http_status::OK, }, nonce, ) diff --git a/proxmox-acme/src/lib.rs b/proxmox-acme/src/lib.rs index df722629..b1be9d15 100644 --- a/proxmox-acme/src/lib.rs +++ b/proxmox-acme/src/lib.rs @@ -74,6 +74,8 @@ pub use request::Request; #[cfg(feature = "impl")] pub use order::NewOrder; #[cfg(feature = "impl")] +pub(crate) use request::http_status; +#[cfg(feature = "impl")] pub use request::ErrorResponse; /// Header name for nonces. diff --git a/proxmox-acme/src/request.rs b/proxmox-acme/src/request.rs index 78a90913..2c83255a 100644 --- a/proxmox-acme/src/request.rs +++ b/proxmox-acme/src/request.rs @@ -1,7 +1,6 @@ use serde::Deserialize; pub(crate) const JSON_CONTENT_TYPE: &str = "application/jose+json"; -pub(crate) const CREATED: u16 = 201; /// A request which should be performed on the ACME provider. pub struct Request { @@ -21,6 +20,16 @@ pub struct Request { pub expected: u16, } +/// Common HTTP status codes used in ACME responses. +pub(crate) mod http_status { + /// 200 OK + pub(crate) const OK: u16 = 200; + /// 201 Created + pub(crate) const CREATED: u16 = 201; + /// 204 No Content + pub(crate) const NO_CONTENT: u16 = 204; +} + /// An ACME error response contains a specially formatted type string, and can optionally /// contain textual details and a set of sub problems. #[derive(Clone, Debug, Deserialize)] -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel