')"
}
-if [ -z "$REQUEST_METHOD" -a -z "$SERVER_PROTOCOL" ]; then
+if [ -z "$REQUEST_METHOD" ]; then
# no webserver variables means we are running via inetd / ncat
# so use builtin web server
| tr , %
}
+PATH(){
+ printf %s "$1" \
+ | sed -r 's;^.*$;/&/;; s;/+;/;g;
+ :X;
+ s;^/\.\./;/;; s;/\./;/;g;
+ tX;
+ s;/[^/]+/\.\./;/;;
+ tX;
+ s;^(/.*)/$;\1;'
+}
+
+
SET_COOKIE(){
case "$1" in
''|0|session) expire='';;
}
REDIRECT(){
- printf '%s: %s\r\n'
+ printf '%s: %s\r\n' \
Status "303 See Other" \
Content-Length 0 \
Location "$*"