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 919841FF13B for ; Wed, 11 Feb 2026 17:18:23 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C2B7932CE1; Wed, 11 Feb 2026 17:19:06 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup 1/3] http client: use http proxy from client options if set Date: Wed, 11 Feb 2026 17:18:43 +0100 Message-ID: <20260211161845.1006528-3-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260211161845.1006528-1-c.ebner@proxmox.com> References: <20260211161845.1006528-1-c.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770826655783 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.046 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: XBWD2MNUIXO4XEP263UWMDBVQJXFEHZR X-Message-ID-Hash: XBWD2MNUIXO4XEP263UWMDBVQJXFEHZR X-MailFrom: c.ebner@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 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: The client already supports reading the proxy config from the env variables, now it is also possible to specify it as optional parameter via the http client options. For backwards compatibility always use the env variable proxy setting over the http client option. To be used for setting the http proxy on remotes for sync jobs. Signed-off-by: Christian Ebner --- pbs-client/src/http_client.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pbs-client/src/http_client.rs b/pbs-client/src/http_client.rs index 4730db8d1..43f9a3367 100644 --- a/pbs-client/src/http_client.rs +++ b/pbs-client/src/http_client.rs @@ -134,6 +134,7 @@ pub struct HttpClientOptions { fingerprint_cache: bool, verify_cert: bool, limit: RateLimitConfig, + proxy: Option, } impl HttpClientOptions { @@ -196,6 +197,11 @@ impl HttpClientOptions { self.limit = rate_limit; self } + + pub fn proxy(mut self, proxy: Option) -> Self { + self.proxy = proxy; + self + } } impl Default for HttpClientOptions { @@ -209,6 +215,7 @@ impl Default for HttpClientOptions { fingerprint_cache: false, verify_cert: true, limit: RateLimitConfig::default(), // unlimited + proxy: None, } } } @@ -479,6 +486,8 @@ impl HttpClient { } let proxy_config = ProxyConfig::from_proxy_env()?; + let proxy_config = proxy_config.or(options.proxy.clone()); + if let Some(config) = proxy_config { info!("Using proxy connection: {}:{}", config.host, config.port); https.set_proxy(config); -- 2.47.3