From f6fa7fb84db95642b28bcaa5722a5c48939720e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Fri, 8 Oct 2021 00:30:25 +0200 Subject: [PATCH] strip _BASE path from PATH_INFO variable --- cgilite.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cgilite.sh b/cgilite.sh index a2aa329..526a0fc 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -48,7 +48,7 @@ _EXEC="${_EXEC:-${0%/*}}" _DATA="${_DATA:-.}" _EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}" -# Carriare Return and Line Break characters for convenience +# Carriage Return and Line Break characters for convenience CR=" " BR=' ' @@ -90,7 +90,7 @@ HEX_DECODE(){ *) out="${out}${in%"${in#?}"}"; in="${in#?}"; continue;; esac; - # Hex escaes for printf (e.g. \x41) are not portable + # Hex escapes for printf (e.g. \x41) are not portable # The portable way for Hex output is transforming Hex to Octal # (e.g. \x41 = \101) case $in in @@ -146,6 +146,7 @@ if [ -z "$REQUEST_METHOD" ]; then SERVER_PROTOCOL="${SERVER_PROTOCOL%${CR}}" PATH_INFO="$(HEX_DECODE % "${REQUEST_URI%\?*}" |PATH)" + PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")" [ "${REQUEST_URI}" = "${REQUEST_URI#*\?}" ] \ && QUERY_STRING='' \ || QUERY_STRING="${REQUEST_URI#*\?}" -- 2.39.2