diff options
author | makefu <github@syntax-fehler.de> | 2021-11-07 14:31:25 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2021-11-07 14:31:25 +0100 |
commit | 597f546e9833b2569ee6ec540f688f7fb95bd26c (patch) | |
tree | e7393bb0aea4faee24e85e63d82843bd3b9a0bac /krebs/5pkgs/simple/htgen-cyberlocker | |
parent | 9392c355ad5198346313ef0972db1910c10d17bf (diff) | |
parent | 0e668121a1388914f33a6546c2f63adc212a38c4 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'krebs/5pkgs/simple/htgen-cyberlocker')
-rw-r--r-- | krebs/5pkgs/simple/htgen-cyberlocker/default.nix | 5 | ||||
-rw-r--r-- | krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker | 14 |
2 files changed, 16 insertions, 3 deletions
diff --git a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix index 515ea3cf9..c7d7ebfd8 100644 --- a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix +++ b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix @@ -1,5 +1,6 @@ -with import <stockholm/lib>; -{ pkgs, stdenv }: +{ pkgs, stockholm, stdenv }: +with stockholm.lib; + stdenv.mkDerivation rec { pname = "htgen-cyberlocker"; version = "1.0.0"; diff --git a/krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker b/krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker index ab9c4e8e3..5ca0ddd3e 100644 --- a/krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker +++ b/krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker @@ -1,3 +1,10 @@ +emptyok_response() {( + printf "HTTP/1.1 204 OK\r\n" + printf 'Connection: close\r\n' + printf 'Server: %s\r\n' "$Server" + printf '\r\n' +)} + delete_response() { jq -n -r \ --arg server "$Server" \ @@ -44,7 +51,10 @@ read_uri() { } uri=$(read_uri "$Request_URI") -path=$(jq -nr --argjson uri "$uri" '$uri.path') +path=$(jq -nr --argjson uri "$uri" ' + $uri.path | + gsub("/+"; "/") +') case "$Method $path" in 'POST /'*|'PUT /'*) @@ -57,6 +67,8 @@ case "$Method $path" in mkdir -v -p $STATEDIR/items >&2 cp -v $content $item >&2 + + emptyok_response exit ;; 'GET /'*) |