Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
15Activity
0 of .
Results for:
No results containing your search query
P. 1
A Simple Web Proxy

A Simple Web Proxy

Ratings: (0)|Views: 1,670|Likes:
Published by Dvschumacher
This is my school job, a proxy program. Please note, this program will only be available in Linux C. This is just a server, the client can be any browser (No matter which OS is used). The server will work in Linux command: ./FileName PortNumber Efficient. Please have a look at the document first. PLEASE NOTE: Those who want to ask me questions please send E-mail to me DIRECTLY since this websites is forbidden to visit in China.
This is my school job, a proxy program. Please note, this program will only be available in Linux C. This is just a server, the client can be any browser (No matter which OS is used). The server will work in Linux command: ./FileName PortNumber Efficient. Please have a look at the document first. PLEASE NOTE: Those who want to ask me questions please send E-mail to me DIRECTLY since this websites is forbidden to visit in China.

More info:

Categories:Types, School Work
Published by: Dvschumacher on Jan 27, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

11/04/2013

pdf

text

original

 
 Project report 
Design and implementationof HTTP proxy server 
Course Title:
 
 Internet Applications
Name:
 
 Li Shengchen (072839)Meng Fanda (072838)
Date:
 
 Dec. 31st, 2007 
 
 
Overview
The coursework asks us to program a proxy application of HTTP, with some specific demands asoptional demands. The most general demand is retransmit the content of a webpage from a webserver to a client. Furthermore there are some statistics available in server end as well. The trafficthroughput and response time are available in our application. Another optional function is adding“Proxy” to each title of web sites. However, since the function is not very stable, we make thisoptional by choosing different port number (port number larger than 8000 has this function only).By overcoming the difficult point of the application, we use a third argument in command line inserver terminal indicating the efficiency of the application where 0 indicates lowest (but acomplete site) and from 1 then, the larger number means slower load rate (however, the web pagecontent may be lost if the Internet link is not fast enough thus 1 stands for fastest load rate). The proxy provides service only after correct password and username are entered.
Requirements Analysis
This application is programmed in Linux (Ubuntu 9.10) System with C compiler (Build EssentialVersion 11.7). During the communication process, there are 3 parts get involved: the client, the proxy server and the web server. Since this program need operation in Internet, the socket isneeded. There are three sockets needed. The first one takes responsibility of listening request fromthe client. The second one is used for communication between the client and the proxy server. Thethird one is used for communication between the proxy server and the web server. However, sincethere’s some operation during the proxy process, some changes of request and response in HTTPheader is requested. This means some operation about string using pointer, an advanced request istry to make the algorithm efficient in order to get a quicker response time. The statistics of throughput and response time are obtained in the process of retransmission as well.
Preliminary Design
To achieve the basic demands, there are five steps to do so. The first is that listen the request fromthe client. The second is receiving the request from the client. The third is sending the request tothe web server. The fourth is used for getting response from the web server. And the last is usedfor sending the response to the client. These processes are easy to achieve by socket except thefirst one.
 
The first one is achieved by a fixed module. In order to deal with all requests at the same time,several processes in system shall be started. First one is known as the parent process or main process. By binding the socket in specific port and three shakes, the main process listen therequest from the client. If there’s one, there will be a new socket and a child process will becreated. In the child process, the old socket will be closed and the new socket will process allrequests. In the parent process, the new socket will be closed since they won’t be used any morewhereas the old socket will keep alive to listen to new request.However, the key process in this program is to process the content to send and achieve. Generallyspeaking, there’re two key processes. The first one is between receiving the request and sendingrequest. The second is between receiving the response and sending the response.In first process, according to the definition of HTTP header in RFC 2616, we need to check the proxy authentication of using a proxy. Some commands in HTTP should be found (ProxyAuthentication: Basic …). If there’s not such a command, the proxy server should reject to offer service to the client by sending “HTTP/1.1 407 …” Then, the browser of client will ask user toenter username and password. A command “Proxy-Authentication” will be append to HTTPheader afterwards. If the username and password fits perfectly, user may start to use the service.Furthermore, for the process in response (to complement the optional function: adding Proxy intitle of webpage), the text response is expected. To achieve this, the command “Accept-Encoding”should be deleted and then the application will receive text response as a result. Furthermore, weneed to analysis the host name and port number in order to fill in the socket address correctly. TheIP address is needed as well by querying DNS server as well.In response process, we can get the throughput though browser and the responding time bycounting the time after sending request until receive the first response. The throughput can becounted by adding the amount of information received. If optional function is triggered by portnumber the user chosen (port number larger than 8000), the string “Proxy:” should be put into the packets, and the “Content-Length” should be modified or deleted if there’s one.
Detailed Design
The key algorithm we making is both about string operation. The first one is adding a string or deleting a string in a specific string. The second one is picking out the domain name of the host.Both operations are based on pointer operation. A special bug-fix method will be involved as wellin this part.The first algorithm is implemented by finding the location of operation with pointer variable. Thefunction strstr in <string.h> is the most common way to find it. The function strstr returns the pointer of a specific string appears first time. By assigning that to a pointer variable, we can easilyget the precious location in a string. However, to store the modified header we need to allocate a

Activity (15)

You've already reviewed this. Edit your review.
Jaglika Perkova liked this
1 thousand reads
1 hundred reads
Rowena Sanchez liked this
Saurabh Yadav liked this
nskurar liked this
shahalpk liked this
wunni3 liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->