About a week ago, while i was playing a couple of online rounds with Return to the Castle Wolfstain: Enemy territory an idea has lighted my brain: a web server to serve only static pages, compatible with lighttpd and apache virtual hosts syntax support, with a caching system based on memcache.
My objective is to write a lightweight web server more that lighttpd to serve only static pages, that it can used in conjuction with apache or lighttpd without write a single line of configuration and without modify your web control panels to support it. Apache syntax and lighttpd syntax supports will be added in a second moment while the caching system will be implemented at the end.
The most important stuff is that the code will relies on few deps: only expat ( http://www.libexpat.org/ ) and memcache! All the necessary code to parse options, configuration files and so on will be hand-written to avoid use of really complex and slow libraries.
If you ask why use Expat instead of libxml and memcache instead of other caching servers or hand written caching server then there is only an answer: Expat is lightweight while memcache is fast and it let to sys administrator to have more caching servers.
Actually tofu start, read command line parameters (User, Group, Root Mode, Daemon Mode, Log File, Document Root, Verbosity Level, one or more combinations of ip and port), detach from console if is requested, switch to the requested user, register signals and prepare itself to recive connections.
If i'm lucky this week i'll be add support for managing connection and for parsing http 1.0 and 1.1 headers, however before it i need to write an allocation manager to free automatically memory at exit and to avoid double free if them happen.
As compilation system i haven't used autoconf/automake but i've written a simple bash script that enumerate all source files in a directory and sub-directories, enumerate all headers files in a directory and sub-directoryes, build an include path, compile all sources build a linking command and at the end link the stuff deleting objects. I'll support autoconf and automake in a second moment, actually i wanna to spent my spare time on the code :)