examples: Added some commentary.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 6 Mar 2011 13:37:45 +0000 (14:37 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 6 Mar 2011 13:37:45 +0000 (14:37 +0100)
examples/python/dynhosts/dynhosts
examples/python/dynhosts/run
examples/static-files/run
examples/vhosts/patterns.conf
examples/vhosts/run

index fae28c8..9a69a70 100755 (executable)
@@ -5,6 +5,8 @@ from ashd import util
 
 children = {}
 root = sys.argv[1]
+
+# Automatically reap all children that die for any reason.
 signal.signal(signal.SIGCHLD, signal.SIG_IGN)
 
 def serve(req):
index fe81f84..d4203ea 100755 (executable)
@@ -1,6 +1,12 @@
 #!/bin/sh
 
+# Change to the directory containing this script
 set -e
 cd "$(dirname "$0")"
 
+# Start htparser running this dynhosts script. The setsid command
+# ensures that SIGINT is only received by htparser and not by
+# dynhosts; it is not of grave importance, but makes shutdown slightly
+# more clean, and hides the KeyboardInterrupt otherwise raised by
+# Python.
 htparser plain:port=8080 -- setsid ./dynhosts .
index f667252..382c6bb 100755 (executable)
@@ -1,6 +1,8 @@
 #!/bin/sh
 
+# Change to the directory containing this script
 set -e
 cd "$(dirname "$0")"
 
+# Simply invoke htparser running dirplex in this directory
 htparser plain:port=8080 -- dirplex .
index 552f2d0..e73838d 100644 (file)
@@ -1,13 +1,23 @@
-child default
-  exec dirplex default-site
+# Sample virtual host configuration. See the patplex(1) manual page
+# for further details on the configuration format.
+
+match
+  # Match localhost specifically. Note that the Host header may
+  # include a port specification, which is optionally matched by the
+  # end of the regex.
+  header host ^localhost(:[0-9]+)?$ i
+  handler localhost
 
 child localhost
+  # The child specification called when the localhost pattern
+  # matches. Simply run dirplex(1) in the subdirectory `localhost'.
   exec dirplex localhost
 
 match
+  # Catch-all pattern for all requests not specifically directed at
+  # localhost.
   default
   handler default
 
-match
-  header host localhost(:[0-9]+)?$ i
-  handler localhost
+child default
+  exec dirplex default-site
index bba9e68..3c21690 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/sh
 
+# Change to the directory containing this script
 set -e
 cd "$(dirname "$0")"
 
+# Start htparser running patplex; see the patterns.conf file for
+# further details.
 htparser plain:port=8080 -- patplex patterns.conf