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

This commit is contained in:
Dominika 2022-01-11 18:41:11 +01:00
parent 5be51165e2
commit a69e756a93

View file

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