Chapter 16

The Hydrant HTTPD


La la la ...


The Manual Page for Hydrant

Syntax

hydrant [flag [argument]]

Flags

-d dataRootDir

Root of the data directory.

-p port

Default port is 80.

-bs bufferSize

Default size is 8096 bytes.

-l logFile

Path to log file.

-i

Return 'index.html' if the URL points to a directory.

-vl

Verbose logging.

-fl

Flush logging.

Special behaviour

If -i is used, then if the URL path points to a directory, hydrant will check to see if that directory contains a file called index.html. If it exits, it'll be returned instead of the directory listing.

Note: hydrant doesn't yet return a directory listing.


Running hydrant

Example usage

1) Compile hydrant. cc hydrant.c -o hydrant mv hydrant /usr/work/gnn

2) Watch the log for start up errors. Try another port using the -p option if the default port is not available. For security reasons, make sure you use the -d to confine outside access to within that directory.

./hydrant -d /usr/work

Log file format

Standard HTTP log format, with the following exceptions: unknown client machine name is denoted by "???"; server error/dianostic messages are intermixed with the access log, but is preceeded with "XXX" characters (filter these lines out to get just the access info).