• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

simple proxy program

Hi experts

I am suppose to write a proxy program which is suppose to do the folllowings, I was wonder if any one could give some hints about how to approache it,

In this assignment you will use the Unix socket API to start the construction of a web proxy. You will be putting together the networking framework for a web proxy but you won't actually cache any web pages. More accurately, this might better be referred to as simply a request forwarder. Your program is to listen for and accept http connections and then read the HTTP request until a line containing
HOST: hostname
(case is not important) is received. The program will then connect to the machine identified by hostname and simply forward the request header (i.e. all the data received before the line containing host) and all the data after it. Data received from the host connected to will simply be forwarded to the requestor. To develop a better understanding of this problem read section 2.2.6 of the text. The steps outlined on page 101 essentially describe what you need to do. Keep in mind that this assignment doesn't actually keep a copy for itself. As a result, with respect to this assignment, step 2 is never executed and step 4 is modified so that a copy of the returned object is not kept.
Implementation Constraints and Suggestions
Your program must be named proxy and take a single argument, the port the program will be listening on for http requests. Potentially, the requestor and the server responding to the requests could both be sending data to your program at the same time. You will need to use threads to deal with this problem. If you are unsure of what to do ask the TA during the tutorial, and/or review your 213 course material. The tar file threads.tar contains the 213 encapsulation of the Posix threading API that might be of use. Note that you will have figure out what compiler linking options are needed.
Don't try to implement this assignment all at once. Instead incrementally build the solution. A suggested strategy is to:

Accept a connection from the requestor (i.e. browser)
Connect to the identified host
Send a "canned" request to the server and simply forward that information to the browser.
Have your program forward the actual request from the client.
Introduce threads to deal with the concurrency issues.
For testing you can intially use telnet (e.g. telnet localhost 6789 will connect to the program on localhost that is listening on port 6789). As you near completion you will want to use a browser and configure its proxy settings to point at your program
Please keep in mind that this is intended to be a simple warm-up assignment. Please do not make it any more complicated than it is.

You may discuss this assignment with your classmates, but you must do your work alone.You are not allowed to show your work, even for discussion or explanatory purposes to other classmates.

0
zahmadian
Asked:
zahmadian
1 Solution
 
tiger0516Commented:
zahmadian, Could you pls drop me an email at winaffiliate At yahoo DOT com?

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now