Add vhosting example script. - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 68468c715b7bd84a26a6b1f0bf97dd9fd8234b8a DIR parent faea5769eee478d9773030f4ece829d2b0db7e13 HTML Author: Christoph Lohmann <20h@r-36.net> Date: Fri, 11 Nov 2022 07:39:56 +0100 Add vhosting example script. Diffstat: A cgi-examples/vhosting.cgi | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+), 0 deletions(-) --- DIR diff --git a/cgi-examples/vhosting.cgi b/cgi-examples/vhosting.cgi @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Some gopher daemons try to emulate some vhosting, by checking, if some +# request path only exists in some directory of a specific host. +# + +basevhosts="/gopher/vhosts" + +for i in $(find "${basevhosts}" -maxdepth 1 -type d); +do + # Check if request exists in some vhost dir. + if [ -e "${i}/${2}" ]; + then + vhost="$(basename "${i}")" + printf "Our vhost is %s!\n" "${vhost}" + printf "Thank you for flying gopher airlines!\n" + + # Serve content accordingly. + + exit 0 + fi +done +