20121203 - Simple Custom Web Server Tricks

Building an ultra minimal web server for my side project. Here are some of the simplifications I'm making,

(1.) Return the entire site and image content in the first reply to minimize first hit latency. Using the Data URI Scheme to embed the images in the single html file directly. Then javascript for anything interactive.

(2.) Skipping reading and parsing the browsers request. Simply returning the entire site reply for any request. This seems to work locally, will need to validate on a loaded machine serving real content. There is an open question if not reading from the socket and later closing will result in kernel buffers filling up. The reply includes the connection close header for HTTP/1.1,

HTTP/1.1 200 OK

(3.) If any other content needs to be linked, just use port number to choose content. This is continuing the "no parsing" overhead simplification.

(4.) Keep content in memory with headers. Skips extra write() or copy.