I decided that it was time to fix up my lightweight HTTP server, as it is kind of messy, and missing certain features. I changed the name to "Parvus", added better routing support, removed the us of decorators, and just all-around improved the code.
The old implementation was this:
from spiderweb import Spiderweb
http = Spiderweb("192.168.0.123", 80)
And the new implementation looks like this:
from parvus import Parvus
return "hello world"
server = Parvus("192.168.0.113")
server.add_route("/(.*?)[.]gif", gif_image, content_type="image/gif")
Definitely an improvement in my opinion.
Still need to figure out a good way to handle 404 errors and the like, as well as include other necessary features (such as error logging, handling for cookies and query strings, and sending more complete HTTP headers in the response).
There isn't much to the source code but you can check it out here:
It's a work in progress, remember. :)