+ unbuffered responses and r[range]

merge-requests/2/head
Dominika Liberda 2021-05-02 23:05:31 +00:00
parent 3608935ea3
commit b1710af38b
2 changed files with 15 additions and 7 deletions

View File

@ -7,11 +7,16 @@ if [[ ${r[status]} == 200 ]]; then
fi
if [[ ${r[status]} == 212 ]]; then
temp=$(mktemp)
source "${r[view]}" > $temp
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n\r\n" || printf "\r\n"
cat $temp
rm $temp
if [[ "${cfg[unbuffered]}" == true ]]; then
printf "\r\n"
source "${r[view]}"
else
temp=$(mktemp)
source "${r[view]}" > $temp
[[ "${r[headers]}" != '' ]] && printf "${r[headers]}\r\n\r\n" || printf "\r\n"
cat $temp
rm $temp
fi
elif [[ "${cfg[php_enabled]}" == true && "${r[uri]}" =~ ".php" ]]; then
temp=$(mktemp)

View File

@ -71,10 +71,13 @@ while read -r param; do
value="$(sed "s/$name=//;s/^ //;s/ $//" <<< $i)"
cookies[$name]="$(echo -e $value)"
done
elif [[ "$param_l" == *"range: bytes="* ]]; then
r[range]="$(sed 's/Range: bytes=//;s/\r//' <<< "$param")"
elif [[ "$param" == *"GET "* ]]; then
r[url]="$(echo -ne "$(url_decode "$(sed -E 's/GET //;s/HTTP\/[0-9]+\.[0-9]+//;s/ //g;s/\/*\r//g;s/\/\/*/\//g' <<< "$param")")")"
data="$(echo ${r[url]} | sed -E 's/^(.*)\?//;s/\&/ /g')"
data="$(sed -E 's/\?/<2F><>MaE_iS_CuTe<54>/;s/^(.*)<29><>MaE_iS_CuTe<54>//;s/\&/ /g' <<< "${r[url]}")"
if [[ "$data" != "${r[url]}" ]]; then
data="$(echo ${r[url]} | sed -E 's/^(.*)\?//')"
IFS='&'
@ -89,7 +92,7 @@ while read -r param; do
r[url]="$(echo -ne "$(url_decode "$(sed -E 's/POST //;s/HTTP\/[0-9]+\.[0-9]+//;s/ //g;s/\/*\r//g;s/\/\/*/\//g' <<< "$param")")")"
r[post]=true
# below shamelessly copied from GET, should be moved to a function
data="$(sed -E 's/^(.*)\?//;s/\&/ /g' <<< "${r[url]}")"
data="$(sed -E 's/\?/<2F><>MaE_iS_CuTe<54>/;s/^(.*)<29><>MaE_iS_CuTe<54>//;s/\&/ /g' <<< "${r[url]}")"
if [[ "$data" != "${r[url]}" ]]; then
data="$(sed -E 's/^(.*)\?//' <<< "${r[url]}")"
IFS='&'