Sie sind auf Seite 1von 30

Table of Contents

Declaration i

Acknowledgement ii

Abstract iii

Introduction v

Chapter 1 : System Study 6

Chapter 2 : System Analysis 7

Chapter 3 : System Design 17

Chapter 4 : Testing 21

Conclusion 27

Bibliography 28
DECLARATION

We here by declare that our project “Proxy Server” and its report submitted in
the partial fulfillment of requirement for the award of degree of Bachelor of
Engineering in Computer Science and Engineering of Jai Narayan Vyas
University, Jodhpur, is authentic work done by us and is not reproduced as it is
from any kind of source.

DEVSHREE GEHLOT
NEELU LAKHANI
B.E. Final yr. C.S.E.
Dept. OF CSE
M. B. M. Engg. College

Proxy Server i
ACKNOWLEDGEMENT

The beatitude that accompanies the successful completion of any task would not
be completed without the appreciation of colleague who made it possible. So with
veneration honor, we acknowledge all those whose guidance and
encouragement has made successful in winding up the project.

It is our privilege to acknowledge with deep sense of gratitude and devotion the
keen interest and invaluable guidance rendered to us by revered guide Mr. N.C.
Barwar, Head, Department of Computer Science & Engineering, M. B. M.
Engineering College, Jai Narain Vyas University, Jodhpur

It’s our privilege to thank Sh. Rajesh Purohit, Sh. Alok Gehlot and Sh. K.R.
Choudhary who have with their unflinching faith, been a source of inspiration for
us always to move towards success.

We are also thankful to whole Department of Computer Science &


Engineering family who provide us the environment for shaping our thoughts in a
statue of success.

Date : 1/06/2007 DEVSHREE GEHLOT


NEELU LAKHANI
Place : Jodhpur B.E. Final yr. C.S.E.
Dept. OF CSE
M. B. M. Engg. College

Proxy Server ii
ABSTRACT

1. Introduction:

A proxy server is a computer that offers a computer network service to allow


clients to make indirect network connections to other network services. A client
connects to the proxy server, and then requests a connection, file, or other
resource available on a different server. The proxy provides the resource either
by connecting to the specified server or by serving it from a cache. In some
cases, the proxy may alter the client's request or the server's response for
various purposes, usually to view websites that are normally not allowed, such as
game sites in school or work place.

2. Features:

 HTTP Request Sharing and Caching: A proxy server receives a request


for an Internet service (such as a Web page request) from a user. If it
passes filtering requirements, the proxy server, assuming it is also a cache
server, looks in its local cache of previously downloaded Web pages. If it
finds the page, it returns it to the user without needing to forward the
request to the Internet. If the page is not in the cache, the proxy server,
acting as a client on behalf of the user, uses one of its own IP addresses
to request the page from the server out on the Internet. When the page is
returned, the proxy server relates it to the original request and forwards it
on to the user.

 Blocking:
There are two types of blocking:
1. URL Blocking

Proxy Server iii


2. Client IP Blocking

 Better response time : An advantage of a proxy server is that its cache


can serve all users. If one or more Internet sites are frequently requested,
these are likely to be in the proxy's cache, which will improve user
response time. In fact, there are special servers called cache servers. A
proxy can also do logging.

Proxy
Web Server Client
Server

Proxy Server iv
INTRODUCTION

About this project

Currently there are billions of web pages on the Internet but only a fraction of
them are frequently accessed. If these frequently used web pages are stored
much nearer to the client and retrieved directly from there instead of accessing
from original server. The network traffic can be brought down to a very
considerable extent. This will also improve the client observed latency. Here we
are implementing the Proxy Server for a LAN, which also acts as a firewall
between LAN and Internet.

Proxy Server v
System Study

CHAPTER 1 :SYSTEM STUDY

1.1Identification of need

In a LAN, it is needed that there should be some security provided by the


administrator and that some unauthorized sites should not be shown to that client
in LAN. It was needed to decrease the web page access time so that those web
pages that have been accessed earlier should not be asked from the web
directly.

1.2Feasibility study

Following points are to be considered in feasibility study:

1.2.1Technology

 Mechanism for Client Server communication


 Browser
 Connection to server
 Cache management

1.2.2Cost and Benefit Analysis


Building proxy server for LAN does not require any financial investment. Cost is
only in form of time and effort of the developer.
Proxy servers are application gateways originally created as part of firewall
systems to improve security. Internal systems connect to the outside world
through the proxy server, and external systems respond to the proxy server. The
external systems do not see a network of internal systems. They see only one
system - the proxy server. Proxy server reduces the response time for any
request from the client.

Proxy Server 6
System Analysis

CHAPTER 2 :SYSTEM ANALYSIS

1.1Requirement Specification

To develop a system according to the need of the end user and compatible to the
most frequently used and easily available software and hardware, a detailed
requirement specification is needed to be performed. The various requirement
specifications are as follows:

1.1.1User requirement

 A major requirement is to develop an application which reduces network


and server load and provides increased client performance for most
frequently used web pages by caching.
 The application should act as a firewall between the LAN and the
Internet. The firewall has to make sure that it denies the requests for any
blocked site.
 It should block those clients in LAN which are restricted for Internet
access.
 It should have a user friendly interface so that even a layman can use it
and understand it with ease.
 The software should be easily upgradeable in which new modules and
features can easily be added.
It needs to be specified that in case of a proxy server the user will be proxy
server administrator.

1.1.2Requirement Analysis

The firewall of proxy has to block the HTTP request emanating from an invalid IP
address. It also has to not to service the request for any link which is blocked by

Proxy Server 7
System Analysis

the proxy administrator. The proxy has to have cache to store the web pages
locally to reduce latency and network load. A user friendly Graphical User
Interface also needed to be supplied for proxy administrator.

1.1.2.1Modeling
Now what will follow is a series of modeling tasks that lead to a complete
specification of requirement and a comprehensive design representation. We will
follow the structured analysis model in which we create and partition data,
functional and behavioral models. Below is the figure for structured analysis.

Data Object Process


Specification
Description [PSPEC]

Entity Data flow


Relation Diagram

Data
Dictionary

State Transition Diagram

Control

Proxy Server 8
System Analysis

1.1.2.2 Data Modeling


Data modeling method make use of the entity relationship diagram. The entity
relationship diagram is used to depict between data objects. The ERD defines all
data that are entered, stored, transformed and produced with in an application.
First of all by having a glance again at the requirement specification we pick up a
list of “things” or ”objects” (here it does not mean object of OOP) that the
application is going to address. Following are the things that evolve into
input/output objects:
 User
 Firewall
 User Interface
 Proxy Administrator
 Cache Manager
 Internet (abstract entity which generates HTTP response)

Associative ER Diagram (Data Desc.)

Cache

Firewall Cache Manager User Interface

Proxy Server

Proxy Server 9
System Analysis

Expanded ER Diagram

Internet

1 stores
User 2 checks
Cache Manager Cache
3 retrieves
Sends modified
Request
Sends request
Firewall

Updates

User Interface

Handles

Proxy Administrator

Expanded ER Diagram
Firewall
Firewall has to block the HTTP request from the invalid IP’s, for the blocked
URLs reformat for the allowed Content Type. Therefore, it must maintain the list
of all the three. It also has to generate the error message for invalid request.

Proxy Server 10
System Analysis

Cache
The Cache stores the web documents (HTTP Response) that could be
accessed for the future use.

1.1.2.3Functional Modeling and Information Flow


As information moves through software, it is modified by a series of
transformations. Data Flow Diagrams is a graphical representation that depicts
information flow and transformations that are applied as data moves from input to
output.
Here while depicting DFD we have assumed that the user views proxy and
Internet as the system.

Context Flow Diagram

USER USER

HTTP Request HTTP Response

Proxy

URL’s IP’s Log

ADMINISTRATOR ADMINISTRATOR

Proxy Server 11
System Analysis

Data flow diagram - Level 1

USER

HTTP Request HTTP


Response
WEB
FIREWALL SERVER
Modified
Requests
Parsed HTTP
Valid
URLs Request/Response
IP
PROXY
IP’s URL’s MANAGER

CACHE
MANAGER
USER
INTERFACE

URL’s Log
IP’s
CACHE

PROXY ADMINISTRATOR

Proxy Server 12
System Analysis

Process Specification [PSPEC]:

Firewall:
It has to act as a filter to block the HTTP request from the user. It has to compare
the IP address in request header with those made available to it, if address
matches then it checks whether the requested links is blocked or not. If it is
blocked then it returns error message to the user. Else it modifies the request
header according to the Content Type enabled/disabled in firewall. Then it sends
the request to the Cache Manager.

User Interface:
It is handled by the Proxy Administrator. He supplies the list of valid IP addresses
from which the proxy can provide services through the UI. The UI then updates
the corresponding file. Same holds for blocked sites.

Cache Manager:
It is responsible for storing, deleting and searching of web pages in the cache. It
is process which has to handle HTTP request and response after it is forwarded
by the firewall. When it gets HTTP request from the firewall: it first checks
whether the links associated with that request is present in cache or not. If not, it
will send the request to the Internet to get appropriate response: it will update the
cache and send response to the user simultaneously. The policy for adding or
deleting cache will be specified by the cache only.

Proxy Server 13
System Analysis

Data Flow Diagram – Level 2

Cached Response

LAN PC
HTTP PROXY
Request INTERFACE

Validate
Error IP
Message
Valid IP’s
Error
Code
Configuration Files

HTTP
Request Search
Error Blocked
URL’s Cache
code
Resolve

Error
Code Cached
Check Response
URL
URL
HTTP
Response
Internet Forwarded
Cache
Request

Cache
HTTP
Updating
Request
Data
Web Server Get from
Web
HTTP
Response HTTP Cache
Response Manager

Proxy Server 14
System Analysis

Process Specification [PSPEC]:

Validate IP:
It reads the IP address from the HTTP request header and matches with the list
of IP’s presented by the Proxy Administrator. If the match is found then it will
forward the request header to the nest process. If match is not found, it will return
an error code.

Check URL:
On receiving the request header from the validate IP function it will check that the
web document represented by the URI is blocked by the Proxy Administrator or
not. It does so by comparing the URL with the list of URL’s presented by the
Proxy Administrator. If match is not found it will forward the header to the next
process. If found then it will return an error code.

Search Cache:
It reads the URI from the header and searches the cache to find whether the web
document is present in cache or not. If found it will return the cached web
document to the IP address specified in the header.

Get From Web:


It sends the request header to the proxy server or the web server to which it is
connected. It returns the fresh web document to the user or the error code.

Cache Manager:
The cache policy implementer works as the interface to manipulate or update the
cache. Only this function can write or delete anything from the cache. Any
algorithm for page replacement can be implemented in this interface only.

Proxy Server 15
System Analysis

System Recommended

In this step we draw up an understandable plan of what type of Hardware and


system is required to run the application in a compatible manner. So the system
requirements for the proposed system are as follows:

 Network Interface Card.


 Modem.
 Dial Up Connection/Leased Line

1.1.3Software Requirements

In this step we draw up an understandable plan of the requirement of the various


software needed to run the application in a compatible manner. So the software
requirements for the proposed system are as follows:

 Windows 98/NT/2000/XP.
 Internet Explorer
 Tomcat Apache server4.0(for testing purpose).
 JDK 1.4

Proxy Server 16
System Design

CHAPTER 3 :SYSTEM DESIGN


Our goal is to produce a model or representation of the proxy application, which
will be built later. By passing through the phases of diversification and
convergence we focus on four aspects:

 Data Design
 Architectural Design
 Interface Design
 Component Design

1.1Data Design

The data Design transforms the information domain model created during
analysis to the data structures that will be required to implement the software.
The data Objects and relationships defined in the entity relationship diagram and
detailed data content depicted in the data dictionary provide the basis for the
data design activity.
Following are the data structures that will be used to implement the application:

1.1.1HTTP Request
This will be the input to the proxy system. It has to accept the HTTP Response
and validate and manipulate it in the firewall.

1.1.2HTTP Response
This is required to be the output to the LAN PCs. It also has to store the HTTP
Response in the Cache for the future user.

Proxy Server 17
System Design

1.1.3Cache
The basic requirement of cache is to store the Web Documents, which could be
referenced by the LAN PCs in future. The Cache needs to be stored in main
memory for fast and efficient access.

1.1.4Error Message
Appropriate error messages are to be shown to the user for any error
encountered. The user can only view web page, hence messages should be
HTML tagged.

1.1.5Files

1.1.5.1Valid IP’s
The file contains the list of IP address on the LAN, which can access the services
of the Proxy Server.

1.1.5.2Blocked Sites
It contains the list of blocked URL’s.

1.1.5.3Cache Folder
The Cache Folder will store cache present in the main memory in the form of
files. Each HTTP Response will be stored as a separate file corresponding to its
URI. This will be used only on start-ups or shutting down the proxy server.

1.2Architectural Design:

The software architecture of a program o computing system is the structure


or structures of the system, which comprise software components, the externally
visible properties of those components and the relationship among them.

Proxy Server 18
System Design

The architecture is not the operational software. Rather, it is representation


that enables a software engineer to:
Analyze the effectiveness o the design in meeting its stated requirements.
Consider architectural alternatives at a stage when making design changes is still
relatively easy, and
Reducing the risks associated with the construction of the software.

1.2.1Functional Modules
The various functional modules needed to perform its basic functions of a proxy
server are:

1.2.1.1Proxy User Interface


This Module is responsible to control and manage the User Interface. It will
provide the user with an easy to use GUI, a window with menu.
The menu options should provide commands to perform the following functions:
 Start Proxy
 Stop Proxy
 Exit
 Blocking URL
 Blocking Client
 Manage Log
 Manage Cache
 Modify Configuration

1.2.1.2Proxy Server Listener


The main function of the proxy starts here. This module will serve as a Port
listening to clients i.e. page requests from a web browser. It will create a new
connection for each request from the clients.
One more important feature of this module would to block clients which are
there in the blocked list given by the user.

Proxy Server 19
System Design

1.2.1.3Connection Manager
This module will contain the main functions of the Proxy Server. It will read the
request header from the client. It will parse the URL and determine whether the
URL is blocked or not. Else it will generate a connection to the web server.
Then it will read the reply header from the web server. If there is no copy of the
page in then cache then it will download the page from Web Server else will
check its last modified date from the reply header and accordingly will read from
the cache or serve from the Web. Then it will also check the header for caching
allowed or not and accordingly will cache the page.

1.2.1.4Cache Manager
The Cache Manager is responsible for storing, deleting, clearing and
searching of web pages in the cache.

1.2.1.5Log Manager
The Log Manager is responsible viewing, clearing and updating the Log.

1.2.1.6Configuration
This module will enable the user to make his configuration settings. It will work
with the other modules to perform the desired configurations such as caching
(on/off), log (on/off), etc.

1.3User Interface Design

The Golden rule that guides the design of effective user interface is:
 Place the user in control
 Reduce the user’s memory load.
 Make the interface consistent.
The user interface is the window to software system. It should be convenient and
easily understandable even by the naïve users. We have provided an easy to
use user interface in the form of menu’s in which functions are categorized
according to relevance.

Proxy Server 20
Testing

CHAPTER 4 :TESTING

1.1SOFTWARE TESTING

Software testing is a critical element of software quality assurance and


represents the estimate review of specification, design and coding. Testing is a
process of executing program with the intention of finding errors in software. Our
objective was to design test cases that uncover errors in minimum time and less
effort. As a secondary benefit, testing demonstrates that software functions
appear to be working according to requirements. The cases should be designed
in a way that:

All independent logical paths within a module are exercised, all logical decisions
are exercised, all loops are executed and all data structures are exercised for
their validity i.e. White Box Testing.
All functions are fully operational and that input is properly accepted and correct
output is produced. This is Black Box Testing.

These two test case design techniques are used invariably in a software testing
strategy which solves test planning, test case design, test execution, and
resultant data collection and evaluation. A strategy for software testing involves
four steps:

 Unit Test
 Integration Test
 System Test

Proxy Server 21
Testing

Unit testing

Module
testing

Sub-system
testing

System
testing

Acceptance
testing

Unit Testing Integration Testing System Testing

1.1.1Unit Testing

Unit testing focuses various verification efforts on the smaller unit of software
design module. Here the module interface is tested to ensure that information
properly flows into and out of the program unit under test. It ensures that integrity
is maintained during all the activities of a session. Boundary conditions are tested
to ensure that the module operates properly at the boundaries established to limit
or restrict processing. All independent paths through the control structure are
exercised to ensure that all statements in a module have been executed at least
once. And finally, all error-handling paths are tested.

Proxy Server 22
Testing

Testing is done with the test cases, which are supplied, from the client and also
by the prepared by the offshore, for rigorous unit testing.

1.1.2Integration Testing

Integration testing involves testing of modules in executable combination.


Integration testing in this application is carried out as testing the system in its
entirety. The aspects that are considered are:

Testing of interfaces between the modules.


Testing of interface between the integrated modules and its
environment.

Integration testing tests both the physical and the logical interfacing. Physical
interfacing is checks the structure and form of the interfaces. It is verified that the
same data and parameters are passed, with the same order. Logical interfacing
checks the semantic content of the interfaces. In this level the range of the data
are looked that there arc in the desirable form in which the modules need.

1.1.3System Testing

System testing is carried on to ensure that the system is consistent with its
environment. After all these tests the system is installed to the client and it is
checked with all test data to verify that is works fine with the client environment.

This software is dually tested at each level. Sufficient time is devoted on the
testing. Testing is done; keeping in mind that how big price has to pay in case of
software failure.

Proxy Server 23
Testing

1.2Unit Testing of Proxy Server

Different Classes (Modules or Units) were designed for following functionalities:

 Port Listening
 Connection
 Caching
 Log
 Blocking

Firstly, tests were conducted over separate classes and then these classes were
integrated to develop the total software. Testing was performed over various
independent classes i.e. classes which do not require involvement of server
classes. Once the modules (independent classes) were tested, testing start over
dependent classes by associating them with server classes. Various tests
performed and their results are:

1.2.1Port Listening Test


In this test we tried to check whether the Proxy was actually listening or not and
also at the correct port. We tested it against different random values given to the
web browser.
Table 4.1

Port No. to Browser Port No. at Proxy Server Listening

1234 1020 No

1234 1234 Yes

1234 1112 No

1012 1012 Yes

Proxy Server 24
Testing

1.2.2Connection
This test was conducted to check whether individual requests from clients formed
a connection to the Proxy Server or not. The very fact that there was some
output to the browser for each request accordingly, proved that there was a
connection established.

1.2.3Cache Test
This test was conducted by checking the cache folder formed while execution.
Cache replacement and addition of files in cache storage worked properly though
the first response took quite a long time. We noted that those requests with a
copy existing in cache were read from the cache and those not in cache were
requested to the web server and subsequently saved in the cache folder.

1.2.4Log Test
This test was conducted by checking the log folder formed while execution. We
noted that for each request from one IP a file named that IP.log was created or
updated if existing and the URL accessed was added to the file with date and
time.

1.2.5IP Validation Test


For those clients who were blocked their IP was stored in a file. The proxy server
blocked the requests from blocked clients and generated no response to them.

Table 4.2

Blocked IP’s Client IP Blocked?

123.6.3.7 127.0.0.1 No
220.100.101.98
123.6.3.7 Yes
12.76.45.9
120.6.88.32 No
128.3.45.12
221.67.43.100 128.3.45.12 Yes

Proxy Server 25
Testing

1.2.6URL Blocking Test


Again method similar to above was used. A list of URL’s was stored in file. Any
request for these sites was rejected instantly by the proxy server.

Table 4.3

Blocked URL’s Client Request Blocked?

http://www.gmail.com\show?3ngb8g Yes
www.gmail.com
www.google.com No
www.hello.com
www.byte.com www.mail.yahoo.com No
www.zapak.com
228.10.45.1 No
www.yahoo.com
www.byte.com Yes

1.3Integration Test

Since independent classes have been tested, classes which depend on each
other are tested by clustering together these dependent classes. It worked well
under IIS(Internet Information Server) but showed inconsistency with Apache
Server.

1.4System Testing

At the validation or system level, the details of class connection disappear. The
validation of software focuses on user visible actions and user recognizable
outputs from the system. It was found that the application meshed with the
system without showing inconsistency.

Proxy Server 26
CONCLUSION

This software was tested on different testing environment and was found to be
satisfactorily running. The following limitations exist and modification is
suggested:

 The most striking limitation of the software is that it cant’s interact with
other proxy in cascade.

 For most of buttons in GUI keyboard support along with mouse has been
provided but other like selecting an item and then removal of that item
from the list does not have keyboard interaction. The present version can
be extended to include keyboard interaction.

 The present version has no algorithm as such for cache replacement. It


can be extended to include other replacement policies like LRU (Least
recently used) based on timestamp i.e. time in which response is received
back from Web Server and hybrid policy which takes into the account all
the three factors hits, timestamp , and size.

 The proxy currently runs on a single machine. It can be extended to


include facility for control from remote machine

These are several limitations that can be pointed out, and possible extension of
the present version is outlined.

Proxy Server 27
BIBLIOGRAPHY

Bibliography

1. Java 2 The Complete Reference 5th Edition , Herbert Schildt, Tata Mc


Graw Hill.
2. Sun Java Volume 1 & 2.
3. Professional Java Server Programming, Wrox Press Ltd.
4. Roger S. Pressman, Software Engineering: A Practitioner’s Approach

References

1. www.java.sun.com
2. www.jakarta.apache.org

Proxy Server 28

Das könnte Ihnen auch gefallen