summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-10-24 20:15:45 +0200
committerlassulus <lassulus@lassul.us>2021-10-24 20:15:45 +0200
commit9fc5849786a82c4cd5bec695d6f9086237a597df (patch)
tree20bca2c95234b7c533980b761081bd71e0ac1c58 /krebs/5pkgs
parent0f9c6ee7383c52922b9f7ce06b2360806d9de045 (diff)
pkgs.htgen-cyberlocker: fix erronous response
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker14
1 files changed, 13 insertions, 1 deletions
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 /'*)