#!/bin/sh -x ## ## TIADUNSLFANN Is A Dangerously Unsafe Nex Server Looking For A Nicer Name ## ## ncat -l -p 1900 -k -c ./tiadunslfann ## root="$PWD" alias mute-err='2>/dev/null ' IFS='' read request if ! realrequest=$(mute-err realpath "$root/$request") then printf "E: bad request '%s'\n" $realrequest exit fi case "$realrequest" in $PWD*) ;; *) printf "E: bad request '%s' outside doc root\n" $realrequest ; exit ;; esac if [ -f "$realrequest" -a -r "$realrequest" ] then cat "$realrequest" elif [ -d "$realrequest" -a -r "$realrequest/index" ] then cat "$realrequest/index" else printf "E: bad request, no idea about '%s'\n" "$request" fi