geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

vhosting.cgi (488B)


      1 #!/bin/sh
      2 #
      3 # Some gopher daemons try to emulate some vhosting, by checking, if some
      4 # request path only exists in some directory of a specific host.
      5 #
      6 
      7 basevhosts="/gopher/vhosts"
      8 
      9 for i in $(find "${basevhosts}" -maxdepth 1 -type d);
     10 do
     11 	# Check if request exists in some vhost dir.
     12 	if [ -e "${i}/${2}" ];
     13 	then
     14 		vhost="$(basename "${i}")"
     15 		printf "Our vhost is %s!\n" "${vhost}"
     16 		printf "Thank you for flying gopher airlines!\n"
     17 
     18 		# Serve content accordingly.
     19 
     20 		exit 0
     21 	fi
     22 done
     23