ohio is a fast'n'dirty 2 days project written in C that implements
a GET HTTP/1.0 web server. It is small but does not require inetd.
352 lines of code
ohio is probably the smallest web server written in C.
This is currently made of 352 lines of C with comments.
Currently it just works nice for lan document sharing.
Features are:
no config file
auto daemonizing
".." and "%2E%2E" protection
GET only accepted
can bind any TCP port
no config file, all in command line
compiles also with dietlibc
Non-features are:
does not yet url-encode local filenames (FIXME)
does not interpret ? or # in URL
does not handle correctly named pipes or devices
does not change its UID on serving files (FIXME)
does not chroot to DocumentRoot(FIXME)
You can learn C by reading the source code of ohio
and imagine improvements from your own.
free software
ohio is free software, released under the WTF Public License v2.0.
(see license in the tarball). Enjoy and stretch the toy :
download ohio