[pbs-devel] [PATCH proxmox-backup] api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA

Dietmar Maurer dietmar at proxmox.com
Wed Apr 28 11:01:34 CEST 2021


---
 src/api2/types/mod.rs | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/api2/types/mod.rs b/src/api2/types/mod.rs
index 66b4d258..0b4e3e55 100644
--- a/src/api2/types/mod.rs
+++ b/src/api2/types/mod.rs
@@ -1610,3 +1610,14 @@ pub struct NodeStatus {
     pub cpuinfo: NodeCpuInformation,
     pub info: NodeInformation,
 }
+
+pub const HTTP_PROXY_SCHEMA: Schema = StringSchema::new(
+    "HTTP proxy configuration [http://]<host>[:port]")
+    .format(&ApiStringFormat::VerifyFn(|s| {
+        crate::tools::http::ProxyConfig::parse_proxy_url(s)?;
+        Ok(())
+    }))
+    .min_length(1)
+    .max_length(128)
+    .type_text("[http://]<host>[:port]")
+    .schema();
-- 
2.20.1





More information about the pbs-devel mailing list