[pbs-devel] [PATCH v2 backup 15/27] tools/http: dedup user agent string

Dietmar Maurer dietmar at proxmox.com
Wed Apr 28 12:37:32 CEST 2021


replaced by my own cleanup patch

On 4/22/21 4:02 PM, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
>   src/tools/http.rs | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/tools/http.rs b/src/tools/http.rs
> index 8ed2fdb7..31dea33a 100644
> --- a/src/tools/http.rs
> +++ b/src/tools/http.rs
> @@ -28,6 +28,8 @@ use crate::tools::{
>       },
>   };
>   
> +const USER_AGENT_STRING: &str = "proxmox-backup-client/1.0";
> +
>   /// HTTP Proxy Configuration
>   #[derive(Clone)]
>   pub struct ProxyConfig {
> @@ -81,7 +83,7 @@ impl SimpleHttp {
>           let request = Request::builder()
>               .method("POST")
>               .uri(uri)
> -            .header("User-Agent", "proxmox-backup-client/1.0")
> +            .header("User-Agent", USER_AGENT_STRING)
>               .header(hyper::header::CONTENT_TYPE, content_type)
>               .body(body)?;
>   
> @@ -99,7 +101,7 @@ impl SimpleHttp {
>           let mut request = Request::builder()
>               .method("GET")
>               .uri(uri)
> -            .header("User-Agent", "proxmox-backup-client/1.0");
> +            .header("User-Agent", USER_AGENT_STRING);
>   
>           if let Some(hs) = extra_headers {
>               for (h, v) in hs.iter() {





More information about the pbs-devel mailing list