Introduction
Introduction Statistics Contact Development Disclaimer Help
Add vhosting example script. - geomyidae - a small C-based gopherd (mirror)
git clone git://git.codemadness.org/geomyidae
Log
Files
Refs
README
LICENSE
---
commit 68468c715b7bd84a26a6b1f0bf97dd9fd8234b8a
parent faea5769eee478d9773030f4ece829d2b0db7e13
Author: Christoph Lohmann <[email protected]>
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(-)
---
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
+
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.