diff options
Diffstat (limited to 'tvix/nar-bridge/src/lib.rs')
-rw-r--r-- | tvix/nar-bridge/src/lib.rs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tvix/nar-bridge/src/lib.rs b/tvix/nar-bridge/src/lib.rs index 2f3dd82439b1..c4a6c8d5f2dc 100644 --- a/tvix/nar-bridge/src/lib.rs +++ b/tvix/nar-bridge/src/lib.rs @@ -1,13 +1,15 @@ use axum::http::StatusCode; +use axum::response::IntoResponse; use axum::routing::{head, put}; use axum::{routing::get, Router}; use lru::LruCache; +use nix_compat::nix_http; use parking_lot::RwLock; use std::num::NonZeroUsize; use std::sync::Arc; use tvix_castore::blobservice::BlobService; use tvix_castore::directoryservice::DirectoryService; -use tvix_castore::proto::node::Node; +use tvix_castore::Node; use tvix_store::pathinfoservice::PathInfoService; mod nar; @@ -56,7 +58,8 @@ pub fn gen_router(priority: u64) -> Router<AppState> { .route("/nar/:nar_str", get(four_o_four)) .route("/nar/:nar_str", head(four_o_four)) .route("/nar/:nar_str", put(nar::put)) - .route("/nar/tvix-castore/:root_node_enc", get(nar::get)) + .route("/nar/tvix-castore/:root_node_enc", get(nar::get_head)) + .route("/nar/tvix-castore/:root_node_enc", head(nar::get_head)) .route("/:narinfo_str", get(narinfo::get)) .route("/:narinfo_str", head(narinfo::head)) .route("/:narinfo_str", put(narinfo::put)) @@ -71,9 +74,12 @@ async fn four_o_four() -> Result<(), StatusCode> { Err(StatusCode::NOT_FOUND) } -async fn nix_cache_info(priority: u64) -> String { - format!( - "StoreDir: /nix/store\nWantMassQuery: 1\nPriority: {}\n", - priority +async fn nix_cache_info(priority: u64) -> impl IntoResponse { + ( + [("Content-Type", nix_http::MIME_TYPE_CACHE_INFO)], + format!( + "StoreDir: /nix/store\nWantMassQuery: 1\nPriority: {}\n", + priority + ), ) } |