You are encouraged to work in groups for this exercise.
To turn in this exercise, email the TA the answers to the questions in bold.
1. Give the URLs of the websites you have chosen, and the number of receive calls to obtain the home page of each of the websites.
If you are unfamiliar with Python, be aware that Python uses indentation to show the structure of the program, so be sure your code has the same indentation as the book. Cutting and pasting could modify the indentation, in which case make sure you restore it correctly.
If you do this exercise correctly, you should be able to see the HTTP response header sent by the server, as well as the content. You will need this information in Part 5. Some websites send back a lot of data -- you may need to scroll back or look around to find a website that sends less data.
If you look carefully, you will find that the header ends with "\r\n\r\n", which is an end-of-line, followed by an empty line.
parts = url.split("/");
2. Turn in your code. If your code works, also report the number of receive calls to obtain "http://manoa.hawaii.edu/records/calendar/index.html".
3. Turn in your code, and state whether it works.
Now modify the server to print each request, so that you can see what requests your clients are sending.
4. Give the name of the web browser you used to connect to your server (Safari, IE, Firefox, etc), and state all the requests that the browser sent to the server. There may be only one request, or there may be more than one -- just observe carefully and report what the requests were.
The header that your server returns should contain at least some of the fields that you saw in Part 1, specifically "Connection: close", "Server: X" (X is a name you choose for your server), "Content-Type: text/html", and "Content-Length: Y", where Y is the number of bytes in the index.html file.
5. Turn in your code for the modified server.
A simple index.html file might contain the following text:
<html> <head><title>Web page for testing web server</title></head> <body>This is a web page</body> </html>