#!/bin/sh if test "$REQUEST_METHOD" != GET then printf 'Cha-Control: InvalidMethod\n' exit 1 fi opath=/${MAPPED_URI_PATH#"${MAPPED_URI_PATH%%[!/]*}"} path0=$(printf '%s\n' "$opath" | "$CHA_LIBEXEC_DIR"/urldec) path=${path0##/?} t=${path0%%"$path"} t=${t##?} if test "$t" = 7 && test -z "$MAPPED_URI_QUERY" then exec cat <

Search $MAPPED_URI_SCHEME://$MAPPED_URI_HOST:$MAPPED_URI_PORT$opath

EOF else LF=' ' case $t in 1|7) msg="Content-Type: text/gopher$LF";; h) msg="Content-Type: text/html$LF";; g) msg="Content-Type: image/gif$LF";; p) msg="Content-Type: image/png$LF";; t|3) msg="Content-Type: text/plain$LF";; ?) msg=;; *) exec cat <