X-Git-Url: http://git.plutz.net/?a=blobdiff_plain;f=cgilite.sh;h=a0a96d1c9191ec2cf849105bd0b910dbfe62db23;hb=b191eb8df453e7e1877443d75214f8b89ee96eaf;hp=6a4a64881faa4bc2836061399974e733bcdba010;hpb=2218e82add4c42ca6ec30c49e0b9cded4dc1e14f;p=cgilite diff --git a/cgilite.sh b/cgilite.sh index 6a4a648..a0a96d1 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -44,11 +44,13 @@ for cgilite_arg in "$@"; do case $cgilite_arg in esac; done unset cgilite_arg -_EXEC="${EXEC:-${0%/*}}" -_DATA="${DATA:-.}" -_EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${BASE%/}" +_EXEC="${_EXEC:-${0%/*}}" +_DATA="${_DATA:-.}" +_EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}" -# Carriare Return and Line Break characters for convenience +export _EXEC _DATA _BASE + +# Carriage Return and Line Break characters for convenience CR=" " BR=' ' @@ -90,7 +92,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 @@ -195,6 +197,8 @@ if [ "${REQUEST_METHOD}" = POST -a "${CONTENT_LENGTH:-0}" -gt 0 -a \ cgilite_post="$(head -c "$CONTENT_LENGTH")" fi +PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")" + debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a /dev/stderr; } [ "${DEBUG+x}" ] && env >&2