From: Fredrik Tolf Date: Sun, 6 Mar 2011 13:37:45 +0000 (+0100) Subject: examples: Added some commentary. X-Git-Tag: 0.7~1^2~4 X-Git-Url: http://git.dolda2000.com/gitweb/?a=commitdiff_plain;h=0c345c82fe0465b7e92076b90e3132ae3b6eba98;hp=121587a56e50fd4cce884d9e61e8796436b150a4;p=ashd.git examples: Added some commentary. --- diff --git a/examples/python/dynhosts/dynhosts b/examples/python/dynhosts/dynhosts index fae28c8..9a69a70 100755 --- a/examples/python/dynhosts/dynhosts +++ b/examples/python/dynhosts/dynhosts @@ -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): diff --git a/examples/python/dynhosts/run b/examples/python/dynhosts/run index fe81f84..d4203ea 100755 --- a/examples/python/dynhosts/run +++ b/examples/python/dynhosts/run @@ -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 . diff --git a/examples/static-files/run b/examples/static-files/run index f667252..382c6bb 100755 --- a/examples/static-files/run +++ b/examples/static-files/run @@ -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 . diff --git a/examples/vhosts/patterns.conf b/examples/vhosts/patterns.conf index 552f2d0..e73838d 100644 --- a/examples/vhosts/patterns.conf +++ b/examples/vhosts/patterns.conf @@ -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 diff --git a/examples/vhosts/run b/examples/vhosts/run index bba9e68..3c21690 100755 --- a/examples/vhosts/run +++ b/examples/vhosts/run @@ -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