ihttpd

ihttpd is a tiny and simple (some would say stupid) http-server that runs under inetd.

A very brief list of the main features:

  • Very small
    ~40KB executable, ~450KB memory footprint with ~400KB shared
  • Very simple
    About 900 lines of code
  • Supports GET and HEAD of static pages
  • Supports GET and POST of CGI-scripts
  • Runs under inetd
  • Supports IPv6

It can serve static and dynamic entities. Static entities are served from files, and dynamic entities are served with CGI scripts. It will make an educated (configurable) guess on the content-type of the static entities and return that as Content-Type header

The CGI interface is a bit different. By default it leaves complete control to the CGI-script. It can also use a wrapper program that makes it more compatible with normal CGI scripts (Status:-line parsing etc).

Minor but important characteristics:

  • No virtual hosts, content negotiation, bandwidth limits, etc
    These things would be easy to do but would increase the size and complexity.
  • No security features besides being simple
    But simple programs tend to be more secure. If you want encrypted transport then use sslwrap. If you want authentication use sslwrap, tcp-tools or do it in CGI-scripts
  • Not compliant with anything
    RFC2616 contains 249 occurrences of “must” and 278 ocurrences of “should”. It is much easier to just make sure it works and is cache-friendly
  • Makes no performance guarantees
    But it seems that it is quite fast for static entities.

ihttpd is also excellent for trying out new implementation details. Want to try TCP_CORK in Linux? mmap()’ed static entity serving? sendfile()? Serve byte-ranges of cgi-output? Automatically compressing and decompressing entities according to client capabilities? Implement WebDAV? ihttpd can do none of it but it is easy to change.

Download

Here: ihttpd-0.5.tar.gz (13KB)

Leave a Reply

Your email address will not be published. Required fields are marked *