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

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Apr 22 16:02:01 CEST 2021


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() {
-- 
2.20.1






More information about the pbs-devel mailing list