diff options
author | Florian Klink <flokli@flokli.de> | 2024-11-28T18·47+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2024-11-29T08·09+0000 |
commit | fa305dea902d1307865763e0ac3e259a58252b29 (patch) | |
tree | 162d02b995ecea7c12a2fee4435550060a9b6239 | |
parent | b59561b9b1cefa1b3a892e4cfd93fcef0d623969 (diff) |
feat(tvix/store): set user-agent for NixHTTPPathInfoService r/8967
Change-Id: I8eb74c5a9457b88ab51bd88084591a4c7c5cdbcc Reviewed-on: https://cl.tvl.fyi/c/depot/+/12849 Reviewed-by: Domen Kožar <domen@cachix.org> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
-rw-r--r-- | tvix/store/src/lib.rs | 3 | ||||
-rw-r--r-- | tvix/store/src/pathinfoservice/nix_http.rs | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tvix/store/src/lib.rs b/tvix/store/src/lib.rs index e1517609d51c..5f1642ce20e4 100644 --- a/tvix/store/src/lib.rs +++ b/tvix/store/src/lib.rs @@ -9,6 +9,9 @@ pub mod utils; #[cfg(test)] mod tests; +// Used as user agent in various HTTP Clients +const USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); + // That's what the rstest_reuse README asks us do, and fails about being unable // to find rstest_reuse in crate root. #[cfg(test)] diff --git a/tvix/store/src/pathinfoservice/nix_http.rs b/tvix/store/src/pathinfoservice/nix_http.rs index e9b83dcf3551..a9e3e4b361f8 100644 --- a/tvix/store/src/pathinfoservice/nix_http.rs +++ b/tvix/store/src/pathinfoservice/nix_http.rs @@ -54,9 +54,14 @@ impl<BS, DS> NixHTTPPathInfoService<BS, DS> { Self { instance_name, base_url, - http_client: reqwest_middleware::ClientBuilder::new(reqwest::Client::new()) - .with(tvix_tracing::propagate::reqwest::tracing_middleware()) - .build(), + http_client: reqwest_middleware::ClientBuilder::new( + reqwest::Client::builder() + .user_agent(crate::USER_AGENT) + .build() + .expect("Client::new()"), + ) + .with(tvix_tracing::propagate::reqwest::tracing_middleware()) + .build(), blob_service, directory_service, |