Table of Contents
The htparser program is the root HTTP server of ashd(7). It listens to specified TCP ports, speaks HTTP with connecting clients, and passes requests on to the root handler program.
When htparser starts, it will first begin listening to all ports specified by PORTSPEC. Once all ports have been bound successfully, it will fork off and start the root handler specified by ROOT, searching the PATH environment variable if necessary, and passing it all the ARGS as command-line arguments. Only after that will htparser do any daemonizing or chrooting as specified by options.
The root handler must be a persistent program as specified in ashd(7). If the handler program exits, htparser will exit too.
PORTSPEC is given in the form
HANDLER[:PAR[=VAL][(,PAR[=VAL])…]]. The
PAR=VAL pairs are used for specifying key-value arguments to the
HANDLER. An example of a valid PORTSPEC is plain:port=8080.
Currently, the available HANDLERs are plain and ssl, for
handling plain TCP connections and SSL/TLS-protected connections,
respectively. For details regarding the arguments that each handler
accepts, simply run htparser with HANDLER:help. For example, the
command "htparser ssl:help" will display help for the ssl handler
to standard output and then exit.
The port specifications must be followed by the -- argument to
distinguish them from the root handler specification.
htparser plain -- dirplex /srv/www
htparser plain:port=8080 -- dirplex /srv/www
htparser plain ssl:cert=/etc/ssl/private/web.pem -- dirplex /srv/www
/etc/ssl/private/web.pem needs
to contain both the server certificate and its private key.
htparser plain -- sudo -u www-user dirplex /srv/www
htparser -f -u nobody -r /var/empty plain -- patplex /etc/ashd/rootpat
/etc/ashd/rootpat file. htparser will
daemonize, change user-ID to nobody and change its root
directory to /var/empty once patplex has been
started. Note that patplex still runs as root in the normal
file system, so that it can start other handler programs as
needed.
htparser -f plain -- errlogger -n ashd dirplex /srv/www
htparser strips away all headers from incoming requests that begin
with the X-Ash- prefix, and adds the following headers to requests:
Fredrik Tolf <fredrik@dolda2000.com>