about summary refs log tree commit diff
path: root/tvix/glue
diff options
context:
space:
mode:
authorVova Kryachko <v.kryachko@gmail.com>2024-11-28T16·06-0500
committerVladimir Kryachko <v.kryachko@gmail.com>2024-11-28T17·16+0000
commitb59561b9b1cefa1b3a892e4cfd93fcef0d623969 (patch)
tree4ae303aa47995d0ad9376adcc11ce6913a45c43f /tvix/glue
parente9b2b0d51cd5bd514f38dc1cc389bd8ae5a5f97e (diff)
chore(tvix/glue): Fix fetchTarball for github urls. r/8966
GitHub does not allow downloads by clients without a User-Agent set.
This changes sets the client User-Agent to "tvix".

Change-Id: I829b37e63bcedb5ea785b55eff5b10175f5caaa6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12845
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/glue')
-rw-r--r--tvix/glue/src/fetchers/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tvix/glue/src/fetchers/mod.rs b/tvix/glue/src/fetchers/mod.rs
index 8dd4fe8439fe..035e9f11a8a7 100644
--- a/tvix/glue/src/fetchers/mod.rs
+++ b/tvix/glue/src/fetchers/mod.rs
@@ -178,6 +178,8 @@ pub struct Fetcher<BS, DS, PS, NS> {
     nar_calculation_service: NS,
 }
 
+const USER_AGENT: &str = concat!("Tvix/", env!("CARGO_PKG_VERSION"));
+
 impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
     pub fn new(
         blob_service: BS,
@@ -186,7 +188,10 @@ impl<BS, DS, PS, NS> Fetcher<BS, DS, PS, NS> {
         nar_calculation_service: NS,
     ) -> Self {
         Self {
-            http_client: reqwest::Client::new(),
+            http_client: reqwest::Client::builder()
+                .user_agent(USER_AGENT)
+                .build()
+                .expect("Client::new()"),
             blob_service,
             directory_service,
             path_info_service,