Improved http response

master
Keith Irwin 2022-09-10 14:11:42 -06:00
parent 92094e5c0d
commit 617463f109
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 6 additions and 6 deletions

View File

@ -6,11 +6,11 @@
# Parse status
status=''
case "${1}" in
''|'0'|'200') status='200 OK\n';;
'201') status='201 Created\n';;
'202') status='202 Accepted\n';;
'400') status='400 Bad Request\n';;
'500') status='500 Internal Server Error\n';;
''|'0'|'200') status='HTTP/1.0 200 OK\n';;
'201') status='HTTP/1.0 201 Created\n';;
'202') status='HTTP/1.0 202 Accepted\n';;
'400') status='HTTP/1.0 400 Bad Request\n';;
'500') status='HTTP/1.0 500 Internal Server Error\n';;
*) exit 3;;
esac
@ -25,4 +25,4 @@ elif [ "${2}" == '' ]
fi
# Send response
printf "${status}${content_type}\n${body}\n"
printf "${status}${content_type}\nDate:$(date)\n${body}\n"