logo

gemini-space

What lives at gemini://hacktivis.me/ git clone https://hacktivis.me/git/gemini-space.git
commit: 0046d8c75922e2d038d1574ffdb3da549877ba6c
parent b01cca832898f0c1177457cce3000071ed5d47d2
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 21 Feb 2021 16:27:42 +0100

server.sh: Fixup cgi-bin logic

Diffstat:

Mserver.sh19+++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/server.sh b/server.sh @@ -31,22 +31,25 @@ fi if [ -r "$path" -a -f "$path" ] then - status="20" - printf '20 %s\r\n' "$mime" - cat "$path" 2>/dev/null -elif [ -r "$path" -a -d "$path" ] -then - if echo $path | egrep -q '^/cgi-bin/' + if echo $query | egrep -q '/cgi-bin/' then if [ -x "$path" -a -f "$path" ] then - env -i PATH="${GEMDIR}/cgi-bin/" "${a/#\/cgi-bin\//./}" + cd "${GEMDIR}/" + env -i PATH=/var/empty/ "$query" status="x$?" else status="50" printf '50 File not executable or non-existent\r\n' fi - elif echo $path | egrep -q '/$' + else + status="20" + printf '20 %s\r\n' "$mime" + cat "$path" 2>/dev/null + fi +elif [ -r "$path" -a -d "$path" ] +then + if echo $path | egrep -q '/$' then if [ -r "$path/index.gmi" -a -f "$path/index.gmi" ] then