* now 302s properly (WiP?)
This commit is contained in:
parent
0793241a3b
commit
5be51165e2
|
@ -1,14 +1,21 @@
|
||||||
if [[ "${cfg[unbuffered]}" != true ]]; then
|
function __headers() {
|
||||||
printf "HTTP/1.0 200 OK
|
if [[ "${cfg[unbuffered]}" != true ]]; then
|
||||||
${cfg[extra_headers]}\r\n"
|
if [[ "${r[headers]}" != *'Location'* ]]; then
|
||||||
else
|
printf "HTTP/1.0 200 OK\r\n"
|
||||||
echo "uh oh - we're running unbuffered" > /dev/stderr
|
else
|
||||||
fi
|
printf "HTTP/1.0 302 aaaaa\r\n"
|
||||||
|
fi
|
||||||
if [[ ${r[status]} == 200 ]]; then
|
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}"
|
||||||
get_mime "${r[uri]}"
|
printf "${cfg[extra_headers]}\r\n\r\n"
|
||||||
[[ "$mimetype" != '' ]] && printf "content-type: $mimetype\r\n"
|
else
|
||||||
fi
|
echo "uh oh - we're running unbuffered" > /dev/stderr
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${r[status]} == 200 ]]; then
|
||||||
|
get_mime "${r[uri]}"
|
||||||
|
[[ "$mimetype" != '' ]] && printf "content-type: $mimetype\r\n"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ ${r[status]} == 212 ]]; then
|
if [[ ${r[status]} == 212 ]]; then
|
||||||
if [[ "${cfg[unbuffered]}" == true ]]; then
|
if [[ "${cfg[unbuffered]}" == true ]]; then
|
||||||
|
@ -16,7 +23,7 @@ if [[ ${r[status]} == 212 ]]; then
|
||||||
else
|
else
|
||||||
temp=$(mktemp)
|
temp=$(mktemp)
|
||||||
source "${r[view]}" > $temp
|
source "${r[view]}" > $temp
|
||||||
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n" || printf "\r\n"
|
__headers
|
||||||
cat $temp
|
cat $temp
|
||||||
rm $temp
|
rm $temp
|
||||||
fi
|
fi
|
||||||
|
@ -24,21 +31,21 @@ if [[ ${r[status]} == 212 ]]; then
|
||||||
elif [[ "${cfg[php_enabled]}" == true && "${r[uri]}" =~ ".php" ]]; then
|
elif [[ "${cfg[php_enabled]}" == true && "${r[uri]}" =~ ".php" ]]; then
|
||||||
temp=$(mktemp)
|
temp=$(mktemp)
|
||||||
php "${r[uri]}" "$(get_dump)" "$(post_dump)" > $temp
|
php "${r[uri]}" "$(get_dump)" "$(post_dump)" > $temp
|
||||||
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n" || printf "\r\n"
|
__headers
|
||||||
cat $temp
|
cat $temp
|
||||||
rm $temp
|
rm $temp
|
||||||
|
|
||||||
elif [[ "${cfg[python_enabled]}" == true && "${r[uri]}" =~ ".py" ]]; then
|
elif [[ "${cfg[python_enabled]}" == true && "${r[uri]}" =~ ".py" ]]; then
|
||||||
temp=$(mktemp)
|
temp=$(mktemp)
|
||||||
python "${r[uri]}" "$(get_dump)" "$(post_dump)" > $temp
|
python "${r[uri]}" "$(get_dump)" "$(post_dump)" > $temp
|
||||||
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n" || printf "\r\n"
|
__headers
|
||||||
cat $temp
|
cat $temp
|
||||||
rm $temp
|
rm $temp
|
||||||
|
|
||||||
elif [[ "${r[uri]}" =~ \.${cfg[extension]}$ ]]; then
|
elif [[ "${r[uri]}" =~ \.${cfg[extension]}$ ]]; then
|
||||||
temp=$(mktemp)
|
temp=$(mktemp)
|
||||||
source "${r[uri]}" > $temp
|
source "${r[uri]}" > $temp
|
||||||
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n" || printf "\r\n"
|
__headers
|
||||||
if [[ "${cfg[encoding]}" != '' ]]; then
|
if [[ "${cfg[encoding]}" != '' ]]; then
|
||||||
iconv $temp -f UTF-8 -t "${cfg[encoding]}"
|
iconv $temp -f UTF-8 -t "${cfg[encoding]}"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue