about summary refs log tree commit diff
path: root/tvix/nix-compat/Cargo.toml
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-08-21T08·06+0300
committerclbot <clbot@tvl.fyi>2024-08-21T09·40+0000
commite03ea11badbf40971d6bf87eede33fe3b046c98b (patch)
treed520dedadeb8193b2da323adb2623a269217951c /tvix/nix-compat/Cargo.toml
parent2357079891819c679821ea58a7715de7be431aaa (diff)
feat(nix-compat/nix_http): init parse_nar[info]_str r/8547
This moves the URL component parsing code we had in nar-bridge to
nix-compat.

We change the function signature to return an Option, not a
Result<_, StatusCode>.

This allows returning more appropriate error codes, as we can
ok_or(…) at the callsite, which we now do: on an upload to an
invalid path, we now return "unauthorized", while on a GET/HEAD, we
return "not found".

This also adds support to parse compression suffixes. While not
supported in nar-bridge, other users of nix-compat might very well want
to parse these paths.

Also fix the error message when parsing NAR urls, it mentioned 32, not
52, which is a copypasta error from the narinfo URL parsing code.

Change-Id: Id1be9a8044814b54ce68b125c52dfe933c9c4f74
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12260
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/Cargo.toml')
-rw-r--r--tvix/nix-compat/Cargo.toml1
1 files changed, 1 insertions, 0 deletions
diff --git a/tvix/nix-compat/Cargo.toml b/tvix/nix-compat/Cargo.toml
index e399d5a2254a..22325ad12bfe 100644
--- a/tvix/nix-compat/Cargo.toml
+++ b/tvix/nix-compat/Cargo.toml
@@ -27,6 +27,7 @@ serde = { version = "1.0", features = ["derive"] }
 serde_json = "1.0"
 sha2 = "0.10.6"
 thiserror = "1.0.38"
+tracing = "0.1.37"
 
 [dependencies.tokio]
 optional = true