Project: Web Proxy
Before taking 15-213, I had absolutely zero network programming experience; I had no idea what a socket was, let alone details such as the differences between HTTP/1.0 and HTTP/1.1 requests. After getting the grasp of these concept through in-class lectures, one of the lab assignments1 for this class was to create a thread-safe proxy which had an internal cache of 1 megabyte. The lab specification is here.
For those of you who are wondering what a proxy is or does, don't worry; I was on the same boat as you until just a few weeks before the course ended. In order to really get it, you must first understand the concept of a client-server relationship. Take, for instance, take what happened when you load a website through your browser:
As you can see, you are the client, and the website host is the server. Now here's where a proxy can come into play. A proxy, when enabled, acts as the "middleman," or intermediary, in between the client and the server. So, the proxy acts as a server for the client, and acts as a client for the server.
The key thing to note here is that the entire experience is completely the same for both the client and server parties. Then why are proxies useful? Proxies are useful for traffic monitoring, website logging, virus checking, caching, and a variety of other reasons. On my side, writing a proxy was extremely useful because it gave me my first introduction to network programming, and incorporated both client- and server-side aspects.
The proxy written by my partner and I, in C, cached server responses under 1 KB and saved them in the program memory until the entire cache size exceeded a megabyte. When the cache became too large, we eliminated the least-recently-used entries from the cache. Furthermore, the entire program was written to be thread-safe; our proxy could handle multiple simultaneous incoming requests and process (and cache) them appropriately without running into problematic race conditions or deadlock situations.
As a side note, the web proxy my partner and I wrote was only equipped to handle HTTP GET requests, which account for over 99% of the request on the internet today. However, because of this limitation, many everyday tasks (such as online chatting, checking email, and form posts) couldn't be processed with our proxy.
Interested in this project? Let me know!
1This project, unlike all other 15-213 projects, was a partner project; I completed this with another 15-213 student.