From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 59AA1776F7 for ; Wed, 28 Apr 2021 11:02:12 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 443BD86AF for ; Wed, 28 Apr 2021 11:01:42 +0200 (CEST) Received: from elsa.proxmox.com (unknown [94.136.29.99]) by firstgate.proxmox.com (Proxmox) with ESMTP id EA0AC8697 for ; Wed, 28 Apr 2021 11:01:39 +0200 (CEST) Received: by elsa.proxmox.com (Postfix, from userid 0) id CAE73AEB21D; Wed, 28 Apr 2021 11:01:39 +0200 (CEST) From: Dietmar Maurer To: pbs-devel@lists.proxmox.com Date: Wed, 28 Apr 2021 11:01:34 +0200 Message-Id: <20210428090134.25652-1-dietmar@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 1 AWL -0.143 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RDNS_NONE 1.274 Delivered to internal network by a host with no rDNS 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-backup] api: add schema for http proxy configuration - HTTP_PROXY_SCHEMA 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: , X-List-Received-Date: Wed, 28 Apr 2021 09:02:12 -0000 --- 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://][:port]") + .format(&ApiStringFormat::VerifyFn(|s| { + crate::tools::http::ProxyConfig::parse_proxy_url(s)?; + Ok(()) + })) + .min_length(1) + .max_length(128) + .type_text("[http://][:port]") + .schema(); -- 2.20.1