git clone http://www.coincoin169.info/git/cchttpd.git cchttpd
cchttpd - a very simple http server which supports only GET
-d ] [
-v ] [
username ] [
groupname ] [
address ] [
port ] [
logfile ] [
Cchttpd is a very simple and lightweight http server for your
website whose root is located at
dir. It only supports the GET
method with possibly a single range. It waits requests on the
standard input and reponds on the standard output. It can be used
inetd(8) in order to respond to network requests. Suppose that
you have installed
/usr/bin and that the root of your
/var/www. Just put in your
inetd.conf the following.
http stream tcp nowait nobody /usr/bin/cchttpd cchttpd /var/www
Make sure that your
/etc/service(5) file contains a line
http 80/tcp # WorldWideWeb HTTP
When the client requests a resource correspoding to a directory on the
cchttpd will send back the listing of the directory ignoring
all files that it cannot open and files beginning with a '
cchttpd cannot open the directory at all, whatever the reason is, it
responds with error
404, Not Found.
Cchttpd can also be used as a stand-alone server. Here is how it
works. On every incoming connexion
cchttpd forks so that each
client (or connexion) is handled by a separate process.
is not intended to be used for big websites. But, even for a
personal website hosted on your personal
computer at your home where your ISP gives you a ridiculous upload,
the retrieval of a large file (say a few MB) can take time. And
during this retrieval time you do not want your website to be off,
hence the fork stuff.
Increase the verbosity of
By default all errors and informations on the functionning
cchttpdare logged. With
-v all informations concerning
the connexions are logged. With
-vv a lot of stuff is logged
mainly for debugging purpose.
This option, along with
-g, can be used for privilege dropdown,
username must be a valid user of the system, for example user
This option, along with
-u, can be used for privilege dropdown,
groupname must be a valid group of the system, for example group
Set the root dir of your website to be
Set the timeout for incomming connection to
timeout. It must be
an integer between
3600 representing seconds. A timeout
0 indicates no timeout. By default the timeout is 5 seconds.
Listen for incoming connexions on the local IP address
Listen for incoming connexions on port
All log messages of
cchttpd wil go to
By default all log messages go to
Some webpages need to be generated when requested by a client.
Cchttpd allows this kind of webpages. Every time a client requests
script which must send the content of
the page onto standard output.
Script must also send the HTTP
headers via standard output. It is strongly recommended that
the HTTP headers look like
HTTP/1.1 200 OK Server: cchttpd Content-Type: mime/type Content-Length: size Connection: close [ real content here]
mime/type must be a valid MIME type and
size must be
the actual size in bytes of the content you want to send. Also
do not forget that new lines must be encoded with
script does not have any information about the
IP address or the URI requested by the client that caused
script to be executed.
Cchttpd does not support any POST
method. Standard input and standard error for
script are redirected
Written by Guillaume Quintin (firstname.lastname@example.org).