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 0B74F1FF144 for ; Tue, 24 Mar 2026 16:26:22 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8FA90166F3; Tue, 24 Mar 2026 16:26:41 +0100 (CET) Date: Tue, 24 Mar 2026 16:26:06 +0100 From: Wolfgang Bumiller To: Christian Ebner Subject: Re: [PATCH proxmox v3 1/2] http: move http proxy schema from PBS to crate's api types Message-ID: <3hjhlavwqmpqrv5s4lofq2vtdtu7e6gvlcwie5sght6l3xtccu@k3ddseqa3n3w> References: <20260312114208.514373-1-c.ebner@proxmox.com> <20260312114208.514373-2-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260312114208.514373-2-c.ebner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774365920132 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.083 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 3MEVIHXJCTELZ2JE2EQLASNUQSYJJSRG X-Message-ID-Hash: 3MEVIHXJCTELZ2JE2EQLASNUQSYJJSRG X-MailFrom: w.bumiller@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pbs-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Mar 12, 2026 at 12:42:01PM +0100, Christian Ebner wrote: > The http proxy schema is used in combination with the ProxyConfig for > verification, the latter being part of the crate already. > > Move also the schema to the crate and guard it behind a api-types > feature to allow for conditional compilation thereof. > > This will easy refactoring the node config in PBS. > > Signed-off-by: Christian Ebner > --- > proxmox-http/Cargo.toml | 2 ++ > proxmox-http/debian/control | 18 ++++++++++++++++++ > proxmox-http/src/lib.rs | 8 +++++--- > proxmox-http/src/proxy_config.rs | 16 ++++++++++++++++ > 4 files changed, 41 insertions(+), 3 deletions(-) > > diff --git a/proxmox-http/Cargo.toml b/proxmox-http/Cargo.toml > index 61a45d1c..f8dde588 100644 > --- a/proxmox-http/Cargo.toml > +++ b/proxmox-http/Cargo.toml > @@ -33,6 +33,7 @@ url = { workspace = true, optional = true } > proxmox-async = { workspace = true, optional = true } > proxmox-base64 = { workspace = true, optional = true } > proxmox-rate-limiter = { workspace = true, optional = true, features = [ "rate-limiter" ] } > +proxmox-schema = { workspace = true, optional = true, features = ["api-types"] } You don't seem to be using the `api-types` feature of `proxmox-schema`. > proxmox-sys = { workspace = true, optional = true } > proxmox-io = { workspace = true, optional = true } > proxmox-lang = { workspace = true, optional = true } > @@ -89,6 +90,7 @@ client = [ > client-sync = [ "client-trait", "http-helpers", "dep:ureq", "dep:native-tls" ] > client-trait = [ "dep:http" ] > http-helpers = [ "dep:http", "dep:proxmox-base64", "dep:proxmox-sys", "dep:serde_json", "dep:url" ] > +api-types = [ "dep:http", "dep:proxmox-schema", "dep:serde_json", "dep:url" ] > websocket = [ > "dep:futures", > "dep:http", > diff --git a/proxmox-http/debian/control b/proxmox-http/debian/control > index 92daac47..b30c3e61 100644 > --- a/proxmox-http/debian/control > +++ b/proxmox-http/debian/control > @@ -21,6 +21,7 @@ Depends: > ${misc:Depends}, > librust-anyhow-1+default-dev > Suggests: > + librust-proxmox-http+api-types-dev (= ${binary:Version}), > librust-proxmox-http+body-dev (= ${binary:Version}), > librust-proxmox-http+client-dev (= ${binary:Version}), > librust-proxmox-http+client-sync-dev (= ${binary:Version}), > @@ -40,6 +41,23 @@ Provides: > Description: Proxmox HTTP library - Rust source code > Source code for Debianized Rust crate "proxmox-http" > > +Package: librust-proxmox-http+api-types-dev > +Architecture: any > +Multi-Arch: same > +Depends: > + ${misc:Depends}, > + librust-proxmox-http-dev (= ${binary:Version}), > + librust-http-1+default-dev, > + librust-proxmox-schema-5+api-types-dev (>= 5.0.1-~~), > + librust-proxmox-schema-5+default-dev (>= 5.0.1-~~) > +Provides: > + librust-proxmox-http-1+api-types-dev (= ${binary:Version}), > + librust-proxmox-http-1.0+api-types-dev (= ${binary:Version}), > + librust-proxmox-http-1.0.5+api-types-dev (= ${binary:Version}) > +Description: Proxmox HTTP library - feature "api-types" > + This metapackage enables feature "api-types" for the Rust proxmox-http crate, > + by pulling in any additional dependencies needed by that feature. > + > Package: librust-proxmox-http+body-dev > Architecture: any > Multi-Arch: same > diff --git a/proxmox-http/src/lib.rs b/proxmox-http/src/lib.rs > index 406f5b8b..79caa23e 100644 > --- a/proxmox-http/src/lib.rs > +++ b/proxmox-http/src/lib.rs > @@ -5,13 +5,15 @@ > #[cfg(feature = "websocket")] > pub mod websocket; > > -#[cfg(feature = "http-helpers")] > +#[cfg(any(feature = "http-helpers", feature = "api-types"))] > pub mod uri; > > -#[cfg(feature = "http-helpers")] > +#[cfg(any(feature = "http-helpers", feature = "api-types"))] > pub mod proxy_config; > -#[cfg(feature = "http-helpers")] > +#[cfg(any(feature = "http-helpers", feature = "api-types"))] > pub use proxy_config::ProxyConfig; > +#[cfg(feature = "api-types")] > +pub use proxy_config::HTTP_PROXY_SCHEMA; > > #[cfg(feature = "http-helpers")] > mod http_options; > diff --git a/proxmox-http/src/proxy_config.rs b/proxmox-http/src/proxy_config.rs > index 7ec68998..8bec3acd 100644 > --- a/proxmox-http/src/proxy_config.rs > +++ b/proxmox-http/src/proxy_config.rs > @@ -6,6 +6,9 @@ use anyhow::{bail, format_err, Error}; > > use http::Uri; > > +#[cfg(feature = "api-types")] > +use proxmox_schema::{ApiStringFormat, Schema, StringSchema}; > + > use crate::uri::build_authority; > > /// HTTP Proxy Configuration > @@ -88,3 +91,16 @@ impl ProxyConfig { > }) > } > } > + > +#[cfg(feature = "api-types")] > +/// Schema for the http proxy configuration > +pub const HTTP_PROXY_SCHEMA: Schema = > + StringSchema::new("HTTP proxy configuration [http://][:port]") > + .format(&ApiStringFormat::VerifyFn(|s| { > + ProxyConfig::parse_proxy_url(s)?; > + Ok(()) > + })) > + .min_length(1) > + .max_length(128) > + .type_text("[http://][:port]") > + .schema(); > -- > 2.47.3