From 1fb5a17f1430840da4990ffa35a04aca96f06d0a Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Wed, 27 Jan 2021 12:52:38 +0100 Subject: feat(users/Profpatsch): add read-http reads a http request or response from stdin, and parses its headers into a netencoded record. Darn rust code took way too long to write. Change-Id: Ie99faa6d4bbd4996fa4e43fb119a11d85b611c99 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2447 Reviewed-by: Profpatsch Tested-by: BuildkiteCI --- users/Profpatsch/read-http/default.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 users/Profpatsch/read-http/default.nix (limited to 'users/Profpatsch/read-http/default.nix') diff --git a/users/Profpatsch/read-http/default.nix b/users/Profpatsch/read-http/default.nix new file mode 100644 index 000000000000..20f8675b3fd4 --- /dev/null +++ b/users/Profpatsch/read-http/default.nix @@ -0,0 +1,19 @@ +{ depot, pkgs, ... }: + +let + + # reads a http request (stdin), and writes all headers to stdout, as netencoded dict + read-http = depot.users.Profpatsch.writers.rustSimple { + name = "read-http"; + dependencies = [ + depot.users.Profpatsch.rust-crates.httparse + depot.users.Profpatsch.netencode.netencode-rs + depot.users.Profpatsch.arglib.netencode.rust + ]; + } (builtins.readFile ./read-http.rs); + +in { + inherit + read-http + ; +} -- cgit 1.4.1