[pbs-devel] [PATCH proxmox 2/4] http: sync: remove redundant calls for setting User-Agent

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Mar 3 12:39:22 CET 2023


the requests are all created via the agent that already contains the user
agent, so this internal helper isn't needed anymore.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
AFAICT at least, there shouldn't be anything relying on the agent being present
as manually added header..

 proxmox-http/src/client/sync.rs | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/proxmox-http/src/client/sync.rs b/proxmox-http/src/client/sync.rs
index 9465d8e..228f839 100644
--- a/proxmox-http/src/client/sync.rs
+++ b/proxmox-http/src/client/sync.rs
@@ -37,19 +37,7 @@ impl Client {
         Ok(builder.build())
     }
 
-    fn add_user_agent(&self, req: ureq::Request) -> ureq::Request {
-        req.set(
-            "User-Agent",
-            self.options
-                .user_agent
-                .as_deref()
-                .unwrap_or(DEFAULT_USER_AGENT_STRING),
-        )
-    }
-
     fn call(&self, req: ureq::Request) -> Result<ureq::Response, Error> {
-        let req = self.add_user_agent(req);
-
         req.call().map_err(Into::into)
     }
 
@@ -57,8 +45,6 @@ impl Client {
     where
         R: Read,
     {
-        let req = self.add_user_agent(req);
-
         req.send(body).map_err(Into::into)
     }
 
@@ -147,7 +133,6 @@ impl HttpClient<String, String> for Client {
         let mut req = self
             .agent()?
             .request(request.method().as_str(), &request.uri().to_string());
-        req = self.add_user_agent(req);
 
         let orig_headers = request.headers();
 
@@ -195,7 +180,6 @@ impl HttpClient<&[u8], Vec<u8>> for Client {
         let mut req = self
             .agent()?
             .request(request.method().as_str(), &request.uri().to_string());
-        req = self.add_user_agent(req);
 
         let orig_headers = request.headers();
 
-- 
2.30.2






More information about the pbs-devel mailing list