


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



In this project, you will use your web server code as the basis for a proxy server. The proxy server will have no functionality (yet!) other than being an intermediary between a web server and a web client. The proxy server will have to be optimized so that it can work very efficiently when com- municating with your own web server running on the same machine.
- Read the entire instructions carefully before you start implementing anything. - You may work individually or in teams of 2. The teams need not be the same as for Project 1. If you are now forming a team but team members did Project 1 independently, be sure to mention what code you used from each team member’s Project 1. - Don’t get stuck! If something is hard to implement the way I suggest, approximate it and go on. - If you have questions, ask one of us! Use the newsgroup for broad questions.
The project consists of four stages. The stages are not balanced; stage 2 should take longer than the rest.
1. Web Proxy Server and Proxy Capable Client
Using your web server code from Project 1, implement a multithreaded web proxy server. (Keep as much code as possible in source files that are shared between the web server and the proxy server.) A proxy server is an intermediary between a web server and a client (the cli-ent could be another proxy server, however). That is, the proxy server receives requests for pages that would normally be served by different web servers. The proxy server contacts the appropriate server, receives the contents of each page, then serves them to the client. (Of course, the proxy server could have cached pages from previous requests, but caching is beyond the scope of this project.)
The only kind of HTTP request you need to support in your proxy server is a GET request. Note, however, that a GET request that is addressed to a proxy server must have an absolute Uniform Resource Indentifier (URI), aka URL, instead of a relative URI. That is, the request will include an internet address of the form:
GET http://orion.cc.gatech.edu:30033/README.html HTTP/1.
Test your proxy server with a standard browser. To set up Netscape to use a proxy, go to Edit->Preferences->Advanced->Proxies->Manual proxy configuration->HTTP Proxy.
Additionally, change your web client from Project 1 to support web proxies. You can do this by adding a command line argument. For instance, your client could be executable as: web_client <#threads> [-proxy proxy_addr]
Be sure your client issues requests with absolute URIs when connecting to a proxy server.
2. Efficient Web Proxy
Overview. Web servers are responsible for serving pages (ensuring security, retrieving files from the file system, creating dynamic pages, etc.), whereas proxy servers can do higher- level page manipulation (e.g., compression, encryption, caching, etc.) without knowing any- thing about how pages are stored on disk or how they are generated dynamically.
An interesting special case is when your web proxy runs on the same machine as your web server and receives a request for a file serviced by your web server. In this case, your web server and your web proxy server are essentially two modules of the same local application that just happen to run in different address spaces. This is a nice system structure because the role of the proxy server is conceptually very different from the role of the web server and one could run with or without the other. When your web server runs on the same machine as your proxy server, transmitting files between them through a socket is inefficient. Instead, the two processes can use shared memory to pass file data efficiently. This optimization is what you need to implement in this stage of the project. Note that this task requires addi- tions both to the web server and the proxy server. Make sure that you can enable and disable the optimization (e.g., use a command line argument, or a compile-time flag) because you will need to compare the optimized and unoptimized versions.
Architecture and Technical Concerns. You are free to implement the basic functionality any way you want, but be sure to document your design in your report. Below, I give an out- line of the basic functionality:
- The proxy server receives a request and extracts the address of the target web server. - If the target web server is on the local machine, the proxy server checks to see if the web server is your own web server. There are two issues here. First, it is a (relatively) hard problem to check whether an internet name is a name (or alias) for the local machine. This project is not about implementing mature internet protocols, so just do something reason- able (like checking if the name maps to the IP address you know for the current host—do not just compare names!) The second issue is how to detect that the web server that will serve the page is your own. Again, any common sense solution will do. Explain the pros and cons of the solution you picked. - The proxy server issues a command to the web server via the socket interface and the web server knows to return file data in a shared memory segment. There are many ways to do this, but do not cheat: the proxy server should know nothing about accessing files from disk! (Otherwise your solution is not modular and might work for static content but would
Using your client, compare the performance of your optimized and unoptimized web server and proxy server pairs. Show the results of experiments (give actual numbers) and explain. Is using shared memory faster or slower? Is it a bandwidth issue or a latency issue? (Think about the kinds of experiments you need to perform to separate the two.) How do you inter- pret the results? (What do they tell you about the operating system and its implementation of cross-process synchronization and/or sockets?) Also, compare the performance of the web server and proxy server pair to just the web server. How much slower does the proxy server make the system?
Turn in the following:
- Source code and binaries. E-mail everything to myself and Durga (please send binaries as attacments). - A report including the README material (description of how code is to be built, platform on which binaries execute, any tips, tricks, you think we’ll need to get your application run- ning), discussion of design choices, results of your experiments. - For teams: a brief explanation of what each team member did.