Added basic proxying; Importing to gitlab.
This commit is contained in:
parent
03f39e3dff
commit
ca2c8b4a50
4
src/response/proxy.sh
Executable file
4
src/response/proxy.sh
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
printf "HTTP/1.0 200 OK
|
||||||
|
${cfg[extra_headers]}\r\n\r\n"
|
||||||
|
|
||||||
|
curl ${cfg[proxy_url]}${r[url]}
|
|
@ -126,6 +126,10 @@ if [[ ${cfg[auth_required]} == true && ${r[authorized]} != true ]]; then
|
||||||
r[status]=401
|
r[status]=401
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${cfg[proxy]} == true ]]; then
|
||||||
|
r[status]=211
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${r[post]} == true && ${r[status]} == 200 ]]; then
|
if [[ ${r[post]} == true && ${r[status]} == 200 ]]; then
|
||||||
|
|
||||||
# This whole ordeal is here to prevent passing binary data as a variable.
|
# This whole ordeal is here to prevent passing binary data as a variable.
|
||||||
|
@ -170,6 +174,8 @@ fi
|
||||||
|
|
||||||
if [[ ${r[status]} == 210 && ${cfg[autoindex]} == true ]]; then
|
if [[ ${r[status]} == 210 && ${cfg[autoindex]} == true ]]; then
|
||||||
source "src/response/listing.sh"
|
source "src/response/listing.sh"
|
||||||
|
elif [[ ${r[status]} == 211 ]]; then
|
||||||
|
source "src/response/proxy.sh"
|
||||||
elif [[ ${r[status]} == 200 ]]; then
|
elif [[ ${r[status]} == 200 ]]; then
|
||||||
source "src/response/200.sh"
|
source "src/response/200.sh"
|
||||||
elif [[ ${r[status]} == 401 ]]; then
|
elif [[ ${r[status]} == 401 ]]; then
|
||||||
|
|
Loading…
Reference in a new issue