Final fix for that hopefully

master
Keith Irwin 2022-09-10 15:09:39 -06:00
parent 131a60349c
commit b193f31874
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 3 additions and 4 deletions

View File

@ -3,8 +3,8 @@
# DESCRIPTION: Formats an http response from arguments
# USAGE: [printf "message" |] res [200] [text/plain]
# Accept stdin as body
body="$(cat)"
printf "${*}\n${body}" >>"${LOGFILE}"
# Parse status
status=''
@ -13,11 +13,12 @@ case "${1}" in
'201') status='Status: 201 Created\n';;
'202') status='Status: 202 Accepted\n';;
'400') status='Status: 400 Bad Request\n';;
'409') status='Status: 409 Conflict\n';;
'500') status='Status: 500 Internal Server Error\n';;
*) exit 3;;
esac
# Parse inputs
# Parse content-type
content_type=''
if [ "${2}" == '' ] && [ "${body}" == '' ]
then content_type=''

View File

@ -59,11 +59,9 @@ domain="${hostname}.${username}.${TLD}"
# Check if new peer already exists
if "${LIB_DIR}/ns_lookup_send" "${domain}" >/dev/null; then
set -x
printf '%s.%s.%s already exists!\n' "${hostname}" "${username}" "${TLD}" >>"${LOGFILE}"
printf 'Hostname %s already exists!\n' "${hostname}" | "${LIB_DIR}/http_res" 409
exit 6
set +x
fi
# Create new domain