This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
""" | |
Task: implement a rudimentary HTTP server in Python. It needs to support the | |
GET method to serve static HTML files. Requests to ``/`` shall be | |
automatically resolved to ``/index.html``. All invalid requests shall be | |
answered with a ``400 Bad Request``. Queries on a non-existing file shall | |
terminate in a ``404 Not Found``. The serving port shall be passed through the | |
command line. The server must be threaded. Use the socket APIs. | |
This implementation is *just a single Python expression,* and only 512 bytes. |