Return proper 404 when path is missing

This commit is contained in:
Michael Raskin 2015-01-03 16:55:56 +03:00
parent 60d0005a0c
commit 187646f071
1 changed files with 15 additions and 7 deletions

View File

@ -19,6 +19,11 @@ header(){
echo echo
} }
header404(){
echo "Status: 404 Not Found"
echo
}
clean_path() { clean_path() {
@gnused@/sed -re "s@^$STORE_DIR/?@@" | @findutils@/xargs @gnused@/sed -re "s@^$STORE_DIR/?@@" | @findutils@/xargs
} }
@ -72,6 +77,7 @@ case "$QUERY_STRING" in
echo "Signature: 1;$KEYNAME;$signature" echo "Signature: 1;$KEYNAME;$signature"
else else
header404
exit 1 exit 1
fi fi
;; ;;
@ -81,6 +87,7 @@ case "$QUERY_STRING" in
header header
@nix@/nix-store --dump "$path" | @xz@/xz @nix@/nix-store --dump "$path" | @xz@/xz
else else
header404
exit 1 exit 1
fi fi
;; ;;
@ -91,6 +98,7 @@ case "$QUERY_STRING" in
header header
@nix@/nix-store --dump "$path" | @bzip2@/bzip2 @nix@/nix-store --dump "$path" | @bzip2@/bzip2
else else
header404
exit 1 exit 1
fi fi
;; ;;