darkhttpd
When you need an httpd in a hurry.
darkhttpd-1.7.tar.bz2 (18,208 bytes)
Features:
- Simple to set up:
- Single binary, no other files, no installation needed.
- Standalone, doesn't need inetd or ucspi-tcp.
- No messing around with config files - all you have to specify is
the www root.
- Written in C - efficient and portable.
- Small memory footprint.
- Event loop, single threaded - no fork() or pthreads.
- Generates directory listings.
- Supports HTTP GET and HEAD requests.
- Supports partial content. (try streaming music files or resuming a
download)
- Supports If-Modified-Since.
- Supports Keep-Alive connections.
- Uses sendfile() on FreeBSD, Solaris and Linux.
- Can use acceptfilter on FreeBSD.
- Tested on FreeBSD, Linux, OpenBSD, Solaris.
- BSD license.
Security:
- Can log accesses, including Referer and User-Agent.
- Can chroot.
- Can drop privileges.
- Impervious to /../ sniffing.
- Times out idle connections.
- Drops overly long requests.
Limitations:
- Only serves static content - no CGI.
History:
- 1.0 - First release.
- 1.1 - Optimized directory listing generation, report CPU usage on exit,
Makefile for the terminally lazy.
- 1.2 - Code cleanup, report traffic stats on exit.
- 1.3 - Added --pidfile and --daemon, a number of
portability fixes, use sendfile() on Solaris.
- 1.4 - Fix a segfault in log_connection(). That was dumb of me.
&sadface;
- 1.5 - Minor performance enhancements, less computation, less memory
manglement, fewer syscalls, much simpler Makefile.
- 1.6 - Fix use-after-free bug.
- 1.7 - In autogenerated directory listings, URL encode links
that need it, found and fixed by nf.
Screenshot:
$ make
cc -O2 -fno-strict-aliasing -pipe `[ \`uname\` = "SunOS" ] && echo -lsocket -lnsl` darkhttpd.c -o darkhttpd
$ ./darkhttpd ~/public_html
darkhttpd/1.7, copyright (c) 2003-2008 Emil Mikulic.
listening on 0.0.0.0:80
^C
caught Interrupt: 2, stopping
$ _
A review of darkhttpd appeared in APC magazine (Jan 2007
issue). Big ups to dandaman for spotting it
and sending me this scan.
Valid XHTML 1.1
Copyright © 2003-2008 Emil Mikulic
$Date: 2008-11-04T09:05:32.409628Z $