From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: Re: [pbs-devel] [PATCH proxmox-offline-mirror] actually include version in user-agent
Date: Tue, 7 Mar 2023 09:43:51 +0100 [thread overview]
Message-ID: <20230307084351.vjspkzd5idjijlj7@fwblub> (raw)
In-Reply-To: <20230303114055.539698-1-f.gruenbichler@proxmox.com>
On Fri, Mar 03, 2023 at 12:40:55PM +0100, Fabian Grünbichler wrote:
> as originally intended.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> if desired, could use option_env + a fallback to some unknown version string
> (that code path would only trigger if rustc is manually invoked, not via cargo)
>
> src/mirror.rs | 5 ++++-
> src/subscription.rs | 7 ++++---
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/mirror.rs b/src/mirror.rs
> index 787e223..cd98e3b 100644
> --- a/src/mirror.rs
> +++ b/src/mirror.rs
> @@ -63,7 +63,10 @@ impl TryInto<ParsedMirrorConfig> for MirrorConfig {
> let key = file_get_contents(Path::new(&self.key_path))?;
>
> let options = HttpOptions {
> - user_agent: Some("proxmox-offline-mirror 0.1".to_string()),
> + user_agent: Some(format!(
> + "proxmox-offline-mirror/{}",
> + env!("CARGO_PKG_VERSION")
> + )),
> proxy_config: ProxyConfig::from_proxy_env()?,
> ..Default::default()
> }; // TODO actually read version ;)
> diff --git a/src/subscription.rs b/src/subscription.rs
> index d186a95..8e3fa51 100644
> --- a/src/subscription.rs
> +++ b/src/subscription.rs
> @@ -12,12 +12,13 @@ use crate::{config::SubscriptionKey, types::ProductType};
>
> // TODO: Update with final, public URL
> const PRODUCT_URL: &str = "-";
> -// TODO add version?
> -const USER_AGENT: &str = "proxmox-offline-mirror";
>
> fn client() -> Result<Client, Error> {
> let options = HttpOptions {
> - user_agent: Some(USER_AGENT.to_string()),
> + user_agent: Some(format!(
> + "proxmox-offline-mirror/{}",
> + env!("CARGO_PKG_VERSION")
> + )),
Could do `concat!(...).to_string()`. (Unfortunately still need the
actual `String` here...)
> proxy_config: ProxyConfig::from_proxy_env()?,
> ..Default::default()
> };
> --
> 2.30.2
prev parent reply other threads:[~2023-03-07 8:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 11:40 Fabian Grünbichler
2023-03-07 8:43 ` Wolfgang Bumiller [this message]
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=20230307084351.vjspkzd5idjijlj7@fwblub \
--to=w.bumiller@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.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