* fix an awful bug, eww how did this get here

merge-requests/3/merge
Dominika 2022-01-11 18:41:11 +01:00
parent 5be51165e2
commit a69e756a93
1 changed files with 6 additions and 5 deletions

View File

@ -1,12 +1,12 @@
function __headers() {
if [[ "${cfg[unbuffered]}" != true ]]; then
if [[ "${r[headers]}" != *'Location'* ]]; then
printf "HTTP/1.0 200 OK\r\n"
if [[ "${r[headers]}" == *'Location'* ]]; then
printf "HTTP/1.0 302 aaaaa\r\n"
else
printf "HTTP/1.0 302 aaaaa\r\n"
printf "HTTP/1.0 200 OK\r\n"
fi
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}"
printf "${cfg[extra_headers]}\r\n\r\n"
printf "${cfg[extra_headers]}\r\n"
else
echo "uh oh - we're running unbuffered" > /dev/stderr
fi
@ -15,6 +15,7 @@ function __headers() {
get_mime "${r[uri]}"
[[ "$mimetype" != '' ]] && printf "content-type: $mimetype\r\n"
fi
printf "\r\n"
}
if [[ ${r[status]} == 212 ]]; then
@ -54,7 +55,7 @@ elif [[ "${r[uri]}" =~ \.${cfg[extension]}$ ]]; then
rm $temp
else
printf "\r\n"
__headers
if [[ "$mimetype" == "text/"* && "${cfg[encoding]}" != '' ]]; then
iconv "${r[uri]}" -f UTF-8 -t "${cfg[encoding]}"
else