htgen-imgur: 1.0.0 -> 1.1.0

Use HTGEN_VERBOSE for printing debug information.
This commit is contained in:
tv 2020-09-15 21:02:01 +02:00
parent cb17a36b44
commit c8f8fdd05b
2 changed files with 13 additions and 9 deletions
krebs/5pkgs/simple/htgen-imgur

View file

@ -2,7 +2,7 @@ with import <stockholm/lib>;
{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, utillinux, stdenv }:
stdenv.mkDerivation rec {
pname = "htgen-imgur";
version = "1.0.0";
version = "1.1.0";
src = ./src;

View file

@ -27,13 +27,15 @@ basic_response() {(
}
')
printf "HTTP/1.1 $status_code $status_reason\r\n"
printf 'Connection: close\r\n'
printf 'Content-Length: %d\r\n' $(expr ${#response_body} + 1)
printf 'Content-Type: application/json; charset=UTF-8\r\n'
printf 'Server: %s\r\n' "$Server"
printf '\r\n'
printf '%s\n' "$response_body"
if test "$HTGEN_VERBOSE" = true; then
printf "HTTP/1.1 $status_code $status_reason\r\n"
printf 'Connection: close\r\n'
printf 'Content-Length: %d\r\n' $(expr ${#response_body} + 1)
printf 'Content-Type: application/json; charset=UTF-8\r\n'
printf 'Server: %s\r\n' "$Server"
printf '\r\n'
printf '%s\n' "$response_body"
fi
)}
@ -78,7 +80,9 @@ case "$Method $path" in
trap "rm $content >&2" EXIT
case ${req_expect-} in 100-continue)
printf 'HTTP/1.1 100 Continue\r\n\r\n'
if test "$HTGEN_VERBOSE" = true; then
printf 'HTTP/1.1 100 Continue\r\n\r\n'
fi
esac
head -c $req_content_length > $content