Core S2 Software Solutions

Mini Web Server

Ever wanted to write a mini web server? Maybe you need an offline web GUI, or just wanted to see how a server works at the bare basics? Today I wrote a 400-line web server application that does the bare basics of fulfilling HTTP 1.1 requests. I also included MIME-type functionality, so when you browse a webpage, you correctly download content (i.e. treat an image as an image, not as a text file).

Unlike Apache Server, I don’t include forking / threading for each session nor do I allow the ability to browser only a set directory. Simply put: this code is a proof of concept and only implements a minimal feature set – don’t use it in production code! If you do use it and expand on the base, tell me what you think and what you’ve added – I’ll be happy to hear of what happens to this code.

Source code is hosted locally here – this should only work for OSX and UNIX-like systems. Play around with the header file includes; some are specific to OSX.

This entry was posted in Programming. Bookmark the permalink.

4 Responses to Mini Web Server

Leave a Reply

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


*

Sites map