Extremely small and barely functional HTTP server
This is a very small HTTP server running on top of inetd and is written in POSIX shell script.
This is the current impressive feature list:
You can copy and paste the source code from below:
#!/bin/sh -e read METHOD URI VERSION [ $METHOD = GET ] || { echo -e "HTTP/1.0 500 Not Implemented\r\n\r" ; exit ; } [ -f $1/$URI ] || { echo -e "HTTP/1.0 404 File Not Found\r\n\r" ; exit ; } echo -e "HTTP/1.0 200 OK\r" echo -e "Content-Type: `file -b -i -L $1/$URI`\r" echo -e "Content-Length: `wc -c < $1/$URI`\r" echo -e "Connection: close\r\n\r" cat $1/$URI
You must configure inetd (in /etc/inetd.conf
) with:
www stream tcp nowait www-data /usr/sbin/extra-mini-http-server extra-mini-http-server /var/www
The extra mini http server was created by Diogo Kollross.