NetProg 2002 HW2

Homework 2: Proxy HTTP Server
NOTE: Due Date has been moved!
(due to the snow day last week, section 2 missed a lecture)

Due Date for Local and live remote students: Wed, Feb 20th (by 11:59PM)
Due Date for Tape and Videostream Delay students: Wed, Feb 27th

Late Penalty: 10 points per day (out of 100)

Submit to netprog-submit@cs.rpi.edu with the subject line "2"
Complete Submission instructions are here


Your assignment is to write a Proxy HTTP Server. Your server must be able to handle GET, HEAD and POST requests (it can ignore any request that specifies any other HTTP request method) sent by a client speaking HTTP version 1.0 or 1.1. Your proxy should work with any HTTP client (browser), we will be testing it with a custom HTTP client written just to torture your server.

What is and is not required:

Server Output

To keep track of all requests, your server should print one line (to standard output) for each request serviced. The line should include the host name or IP address of the client, and the original request-line sent by the client (not any of headers that accompanied the request). For example, the following might be the output generated by your server if it received some requests from a client running on monica.cs.rpi.edu:

> hw2 1234 
monica.cs.rpi.edu:  GET http://www.cs.rpi.edu/
monica.cs.rpi.edu:  GET http://www.cs.rpi.edu/gfx/backg5.jpg
monica.cs.rpi.edu:  GET http://www.cs.rpi.edu/gfx/logo.jpg
monica.cs.rpi.edu:  GET http://www.yahoo.com/images/annakornikova.jpg
monica.cs.rpi.edu:  GET http://fred.com/purchase.asp?prod=17&qty=102
monica.cs.rpi.edu:  HEAD http://www.slashdot.org/
monica.cs.rpi.edu:  POST http://www.fbi.gov/insecuresubmission.cgi

Note that it is not necessary to include the HTTP version number in the output (but feel free to do so if you want).


Deliverables

You should submit all source code files necessary to build your server. If you use a Makefile please include it, if not you need to include instructions on how to build your server. Your submission must also include a file named README that includes the following:

Grading

Your server will be tested to make sure it works properly. We will use a test client that will do it's best to mess up your server by sending nonsense, incredibly long request lines, and invalid web addresses (yes, it will also send many valid requests). It is acceptable that your proxy respond to any nonsense request by sending back an HTTP response code that indicates an error and closing the connection. It's not hard to send back an HTML document as well (that describes the error), but this is not required.

Your testing should include using a real browser (you can tell Netscape or IE to use your server as a proxy), Dave will demonstrate this in class. Although using a real browser through your proxy is a great test, you need to remember that our client will send nonsense requests to your server (and it may be hard to get a real browser to do this). You can use telnet to connect to your proxy and send nonsense, or write your own test client. IMPORTANT: Make sure your proxy can handle images, don't rely soley on simple HTML documents for all your testing!

Points will be awarded as follows (partial credit is available for each item):

GET and HEAD requests work properly with polite clients 30%
POST works properly with polite clients 20%
bad requests are handled without problems 25%
Style/readability 25%

IMPORTANT NOTES ON GRADING:

  • We will check for memory leaks and deduct points (up to 5 points) if we detect a problem. Your server should not get larger (should not require an endless supply of memory) as it handles each request. Make sure you clean up any dynamically allocated memory that is no longer needed!

  • We will also look through your source code to make sure that you handle all possible errors (not just those that our test client can produce). You can lose up to 10 points for not handling errors. You decide what to do when an error occurs, the important thing to remember is that the server should continue running if possible. Feel free to print out error messages (but it's not required). In many cases an error returned by a system call can be dealt with by terminating the connection to the client and moving on to the next client. Other cases are clearly fatal - for example if bind won't give you the port requested, then the server can't get started...

  • Submitting your files

    Submission of your homework is via email, the general idea is to send an email message with all your files as attachments. There is an automated email submission system that will respond to your submission right away, so you will have a record that we got your files.

    All projects must be submitted via email to netprog-submit@cs.rpi.edu. The subject line of the submission message should contain a single number indicating the project number (2 for HW2). You must include your files as attachments, feel free to send a zip-file or a tar file.

    Don't send compiled code!

    You can expect a return email indicating receipt of your project submission immediately. This receipt will include a list of all the files that were successfully extracted by the submission script - please look over the receipt carefully to make sure your submission worked.

    Multiple Submissions: You can resubmit up to 10 times for each project, we will always grade the last submission received unless you tell us otherwise.

    Notes, Hints and Links