Fourth Homework Assignment
Posted 17 Feb 2004 by herman
Write your own web server!
Yes, this assignment, due at 11:59pm on the 25th of February, is to write a threading web server. This is a challenging and rewarding assignment. A number of python examples will help you to write the program.
It's my hope that the techniques illustrated in the examples above, plus a few experiments, will be enough for you to write a threaded web server. Details of the assignment are in homework4.pdf.
- quick_tcp_server.py illustrates the simplest approach to programming a TCP server using threads. Or you can use techniques from the more complete example in threading_tcp_server1C.py.
- cat.py shows how to read a file into a string, so that your web server can have a number of documents available.
- http_get.py is an elementary HTTP client; you can experiment with this program to learn how real web servers return HTML documents (we'll do this in class).
- http_server.py is a partial web server, which you can use to learn the HTTP that browsers send to servers.
- The HTTP 1.0 specification explains (perhaps in too much detail) the HTTP protocol, though you have to look elsewhere to understand the "keep-alive" part of HTTP 1.0.
To repeat, this is a challenging and rewarding assignment. It is important that you start early so that you can ask questions, get clarifications, and build confidence. Experimenting with smaller versions of your program (with lots of print statements) will help. Please feel free to ask questions about this assignment.