From c965c9747b70252976fce59c1da1b61ebe94195d Mon Sep 17 00:00:00 2001 From: Lambda Date: Thu, 29 May 2025 19:49:44 +0000 Subject: [PATCH] Send User-Agent header in outbound requests --- book/changelog.md | 2 ++ src/service/globals.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/book/changelog.md b/book/changelog.md index b0baf25f..978f1a7e 100644 --- a/book/changelog.md +++ b/book/changelog.md @@ -324,3 +324,5 @@ This will be the first release of Grapevine since it was forked from Conduit ([!124](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/124)) 26. Allow adding canonical aliases from remote servers. ([!158](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/158)) +27. Grapevine now sends a User-Agent header on outbound requests + ([!189](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/189)) diff --git a/src/service/globals.rs b/src/service/globals.rs index ede9f5c6..5f8e4c27 100644 --- a/src/service/globals.rs +++ b/src/service/globals.rs @@ -653,7 +653,8 @@ fn reqwest_client_builder(config: &Config) -> Result { let mut reqwest_client_builder = reqwest::Client::builder() .pool_max_idle_per_host(0) .connect_timeout(Duration::from_secs(30)) - .timeout(Duration::from_secs(60 * 3)); + .timeout(Duration::from_secs(60 * 3)) + .user_agent(format!("{}/{}", env!("CARGO_PKG_NAME"), crate::version())); if let Some(proxy) = config.proxy.to_proxy()? { reqwest_client_builder = reqwest_client_builder.proxy(proxy);