Testing Your Web Proxy
After you've managed to get your proxy working even partway, you're going to have to test it out. Because you aren't supplied with trace files this time around, however, you'll have to test it manually. There are several ways to do this (we quickly went over each during lecture) -- they're documented below:
1. Using telnet
telnet is a handy command-line utility that can be used to test a network application. By default, it allows you to connect to a network host (using a hostname or IP address) on a specified port, and subsequently sends all character data you enter, line-by-line, to the remote server. Any information returned by the server is echoed to the screen locally, and the application exits when the server closes the connection.
If you've started your proxy on ada with the command ./proxy 5000 (i.e., specifying that it should listen on port 5000), you can connect to it with the following command:
telnet localhost 5000
If your proxy is set up correctly to listen for and accept connections, it should now be waiting to read and process input, and you can use telnet to send over a request. The following request asks it to fetch the IIT homepage:
GET http://www.iit.edu/ HTTP/1.1
You'll probably also want to test out your proxy with a more deeply nested path -- something like the following would work:
GET http://www.iit.edu/csl/cs/about/mission.shtml HTTP/1.1
Note that you'll need to re-telnet to your server for each separate request.
2. Using a command line browser
Another way of connecting to your proxy is by using a command line (text-only) web browser. Before starting your browser on ada, you'll first need to set an environment variable that tells the browser to use a web proxy, and also tells it where the proxy is located.
Assuming you started your proxy on port 5000, as before, the following sets the necessary environment variable:
export HTTP_PROXY=http://localhost:5000/
Now you're ready to run the command line "w3m" web browser -- you need to provide it with an address to start, like this:
w3m www.iit.edu
Once it's running, you can navigate to links with the arrow keys and "click" on them with the enter key. To navigate to another URL explicitly, tap the 'g' key and type an address into the text field. Hit 'q' to quit, or '?' for help.
3. Using a graphical browser
If you're really ambitious, you can also test your proxy using a modern graphical browser. While it would normally be possible to run your proxy remotely (say, on ada) and connect to it with a browser running on your own machine, ada is unfortunately configured to deny external connections (other than for services such as SSH). The easiest way to do this, then, would be to compile and run the proxy on your own machine.
Assuming you've got gcc (and all required libraries) installed on your machine, and that you've compiled and started your proxy locally, you need to then configure your browser (or operating system) to connect to it. The way you do this depends on your browser/platform, but you can generally access the settings from the browser's advanced preferences panel --- below is a screenshot of how I would configure Firefox on OS X:

Once you're done with this, apply the changes (restarting the browser, if necessary), and browse to a website as usual. Don't be discouraged if this doesn't work too well initially -- browsers initiate a lot of requests when you visit a website, and will definitely give your proxy a workout!
Monitoring the log
To check that your proxy's log file is being used correctly (and consistently), it's helpful to continually monitor the contents of the log as you connect to the proxy and issue requests using one of the above methods.
To do this, you might find the following command helpful:
tail -f proxy.log
As new lines get appended to the end of proxy.log, tail -f will keep printing them to the screen.