From 19d97773a98cc6fe9bc0c83ec2730823fb899fa6 Mon Sep 17 00:00:00 2001 From: Dominika Liberda Date: Mon, 3 May 2021 21:12:02 +0000 Subject: [PATCH] * cfg[unbuffered] now does additional fun things --- src/response/200.sh | 7 +++++-- src/server.sh | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/response/200.sh b/src/response/200.sh index 5ffd350..3947ca6 100755 --- a/src/response/200.sh +++ b/src/response/200.sh @@ -1,5 +1,9 @@ -printf "HTTP/1.0 200 OK +if [[ "${cfg[unbuffered]}" != true ]]; then + printf "HTTP/1.0 200 OK ${cfg[extra_headers]}\r\n" +else + echo "uh oh - we're running unbuffered" > /dev/stderr +fi if [[ ${r[status]} == 200 ]]; then get_mime "${r[uri]}" @@ -8,7 +12,6 @@ fi if [[ ${r[status]} == 212 ]]; then if [[ "${cfg[unbuffered]}" == true ]]; then - printf "\r\n" source "${r[view]}" else temp=$(mktemp) diff --git a/src/server.sh b/src/server.sh index bc2d6b3..02ab77a 100755 --- a/src/server.sh +++ b/src/server.sh @@ -160,6 +160,7 @@ fi echo "${r[url]}" >&2 + if [[ "${cfg[auth_required]}" == true && "${r[authorized]}" != true ]]; then echo "Auth failed." >> ${cfg[log_misc]} r[status]=401 @@ -212,6 +213,9 @@ if [[ "${r[post]}" == true && "${r[status]}" == 200 ]]; then fi fi +# the app config gets loaded a second time to allow for path-specific config modification +[[ -f "${cfg[namespace]}/config.sh" ]] && source "${cfg[namespace]}/config.sh" + if [[ ${r[status]} == 210 && ${cfg[autoindex]} == true ]]; then source "src/response/listing.sh" elif [[ ${r[status]} == 211 ]]; then