diff options
author | tv <tv@krebsco.de> | 2021-11-21 13:44:39 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2021-11-21 13:44:39 +0100 |
commit | e250f858382a1c830a55a7243a80e1fbd2d1b15d (patch) | |
tree | 0dd30c66ddc473112f1f1fcbf0c80ad896a38204 /krebs/5pkgs/simple/htgen-cyberlocker | |
parent | a752af84bedc24fdc32004a8760532b3206c0421 (diff) | |
parent | b0f39ae34d1f248a4c1b92946a42418779f69490 (diff) |
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/5pkgs/simple/htgen-cyberlocker')
-rw-r--r-- | krebs/5pkgs/simple/htgen-cyberlocker/src/htgen-cyberlocker | 14 |
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 /'*) |