X-Git-Url: http://git.plutz.net/?p=cgilite;a=blobdiff_plain;f=server.sh;h=c49c0d8e7f1fd1039eb147a283499c6e6aa037d3;hp=0cb43ffbc57cef49e45c951b7e4194a87df15704;hb=1a1d111199b770c092e1b16a7e03568d3d911b79;hpb=3cb6ff3e7cd50f6a6e22a9a43d5a75fc8aea1c3c diff --git a/server.sh b/server.sh index 0cb43ff..c49c0d8 100755 --- a/server.sh +++ b/server.sh @@ -70,7 +70,7 @@ sed -unr ' ) HTTP_format(){ - LC_ALL=C sed -rn ' + LC_ALL=C sed -urn ' :A /^\r?$/!{H;n;bA} @@ -90,9 +90,10 @@ HTTP_format(){ ' } -PATH_INFO="$(invalidate "${PATH_INFO}" '(^|.*/)\.\./.*' '')" -if [ -z "$QUERY_STRING" -a -f "$_DATA/$PATH_INFO" ]; then - . "$_EXEC/shcgi/static.sh" "$_DATA/$PATH_INFO" +if [ -z "$QUERY_STRING" ]; then + PATH_INFO="$(printf "$(printf %s "$PATH_INFO" |sed 's:+: :g;s:\\:\\\\:g;s:%:\\x:g')")" + PATH_INFO="$(invalidate "${PATH_INFO}" '(^|.*/)\.\./.*' '')" + [ -f "${treeroot:-${_DATA}}/$PATH_INFO" ] && . "$_EXEC/shcgi/static.sh" "${treeroot:-${_DATA}}/$PATH_INFO" exit 0 fi |HTTP_format