public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Stoiko Ivanov <s.ivanov@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-acme-rs 1/1] client: add support for proxies
Date: Thu, 18 Nov 2021 11:15:57 +0100	[thread overview]
Message-ID: <20211118101557.7it5cxsewzfobqtn@olga.proxmox.com> (raw)
In-Reply-To: <20211109165422.311089-3-s.ivanov@proxmox.com>

applied, thanks

On Tue, Nov 09, 2021 at 04:54:16PM +0000, Stoiko Ivanov wrote:
> by storing the proxy url as string in the struct and setting it on
> each invocation of `execute`, since execute calls reset on the
> curl::easy::Easy object.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
>  src/client.rs | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/src/client.rs b/src/client.rs
> index 8aeff97..9853fb6 100644
> --- a/src/client.rs
> +++ b/src/client.rs
> @@ -91,6 +91,7 @@ impl Headers {
>  struct Inner {
>      easy: easy::Easy,
>      nonce: Option<String>,
> +    proxy: Option<String>,
>  }
>  
>  impl Inner {
> @@ -98,6 +99,7 @@ impl Inner {
>          Self {
>              easy: easy::Easy::new(),
>              nonce: None,
> +            proxy: None,
>          }
>      }
>  
> @@ -120,6 +122,10 @@ impl Inner {
>  
>          self.easy.url(url)?;
>  
> +        if let Some(p) = &self.proxy {
> +            self.easy.proxy(&p)?;
> +        }
> +
>          {
>              let mut transfer = self.easy.transfer();
>  
> @@ -156,6 +162,10 @@ impl Inner {
>          })
>      }
>  
> +    pub fn set_proxy(&mut self, proxy: String) {
> +            self.proxy = Some(proxy);
> +    }
> +
>      /// Low-level API to run an n API request. This automatically updates the current nonce!
>      fn run_request(&mut self, request: Request) -> Result<HttpResponse, Error> {
>          self.easy.reset();
> @@ -586,6 +596,11 @@ impl Client {
>              }
>          }
>      }
> +
> +    /// Set a proxy
> +    pub fn set_proxy(&mut self, proxy: String) {
> +        self.inner.set_proxy(proxy)
> +    }
>  }
>  
>  fn parse_header(data: &[u8]) -> Option<(&str, &str)> {
> -- 
> 2.30.2




  reply	other threads:[~2021-11-18 10:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 16:54 [pbs-devel] [PATCH proxmox-backup/proxmox-acme-rs/pwt] acme: add support for http_proxy and wildcard certs Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH widget-toolkit 1/1] acmeplugin: add use-proxy checkbox Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-acme-rs 1/1] client: add support for proxies Stoiko Ivanov
2021-11-18 10:15   ` Wolfgang Bumiller [this message]
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 1/6] api: config: acme: rustfmt Stoiko Ivanov
2021-11-18 10:33   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 2/6] config: acme: plugin: rustfmt Stoiko Ivanov
2021-11-18 10:34   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 3/6] api: acme: fix typo Stoiko Ivanov
2021-11-18 10:34   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 4/6] acme: client: read http_proxy from node config Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 5/6] acme: plugin: add 'use-proxy' property Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 6/6] acme: add support for wildcard certificates Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211118101557.7it5cxsewzfobqtn@olga.proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=s.ivanov@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal