Lab 5: HTTP Web Proxy Server



Similar documents
The exam has 110 possible points, 10 of which are extra credit. There is a Word Bank on Page 8. Pages 7-8 can be removed from the exam.

Cyclope Internet Filtering Proxy. - Installation Guide -

Spam Marshall SpamWall Step-by-Step Installation Guide for Exchange 5.5

Owner of the content within this article is Written by Marc Grote

ComTrader Technical Requirements

This presentation covers virtual application shared services supplied with IBM Workload Deployer version 3.1.

HOW TO CONFIGURE PASS-THRU PROXY FOR ORACLE APPLICATIONS

The Web: some jargon. User agent for Web is called a browser: Web page: Most Web pages consist of: Server for Web is called Web server:

Chapter 1 Load Balancing 99

Web Authentication Proxy on a Wireless LAN Controller Configuration Example

Configuring iplanet 6.0 Web Server For SSL and non-ssl Redirect

Configuring Load Balancing

Linux Squid Proxy Server

Quickstart guide to Configuring WebTitan

Network Technologies

HTTP 1.1 Web Server and Client

How to access Answering Islam if your ISP blocks it

CS 213, Fall 2000 Lab Assignment L5: Logging Web Proxy Assigned: Nov. 28, Due: Mon. Dec. 11, 11:59PM

Practice Fusion API Client Installation Guide for Windows

Apache JMeter HTTP(S) Test Script Recorder

Cyclope Internet Filtering Proxy

DATA COMMUNICATOIN NETWORKING

How to Configure edgebox as a Web Server

Configuring the Avaya B179 SIP Conference Phone with Avaya Aura Communication Manager and Avaya Aura Session Manager Issue 1.0

Building a Multi-Threaded Web Server

Lab 4: Socket Programming: netcat part

MultiSite Manager. Setup Guide

WA2256 Responsive Mobile Web Development with HTML5, CSS3, JavaScript, and jquery Mobile. Classroom Setup Guide. Web Age Solutions Inc.

ZENworks 11 Support Pack 4 HTTP Proxy Reference. May 2016

Setting up a Squid-Proxy Server

Polycom CMA System Upgrade Guide

Outlook Start Outlook, and click on mserver.wlu.ca. 2. From the Tools menu, choose Options

Volume SYSLOG JUNCTION. User s Guide. User s Guide

Virtual Appliance Setup Guide

Blue Coat Security First Steps Solution for Deploying an Explicit Proxy

Computer Networking LAB 2 HTTP

escan SBS 2008 Installation Guide

Smart Policy - Web Collector. Version 1.1

Configuring SonicWALL TSA on Citrix and Terminal Services Servers

Immersion Day. Creating an Elastic Load Balancer. Rev

Configuring Microsoft IIS 5.0 With Pramati Server

1 Introduction: Network Applications

Working With Virtual Hosts on Pramati Server

Installation Procedure SSL Certificates in IIS 7

TABLE OF CONTENTS. Change Server Port in OBIEE 11g Page 2 of 15

Web Browsing Examples. How Web Browsing and HTTP Works

Monitoring Nginx Server

End User Guide The guide for /ftp account owner

Lepide Active Directory Self Service. Configuration Guide. Follow the simple steps given in this document to start working with

Uptime Infrastructure Monitor. Installation Guide

How to set up Outlook Anywhere on your home system

Cybozu Garoon 3 Server Distributed System Installation Guide Edition 3.1 Cybozu, Inc.

Elluminate Live! Access Guide. Page 1 of 7

Ethernet 241 Discovery Tool User Manual

CYAN SECURE WEB APPLIANCE. User interface manual

DEPLOYING WEBTOP 6.8 ON JBOSS 6.X APPLICATION SERVER

Introducing the Microsoft IIS deployment guide

USG40HE Content Filter Customization

FlexSim LAN License Server

JMETER - MONITOR TEST PLAN

2 Downloading Access Manager 3.1 SP4 IR1

Scenario One: YOU CANNOT CONNECT TO THE LIBRARY S WIRELESS NETWORK

Application Notes for Metropolis ProfitWatch Hotel Call Accounting with Avaya IP Office Issue 1.0

How to Make the Client IP Address Available to the Back-end Server

Installing, Uninstalling, and Upgrading Service Monitor

Virtual Appliance for VMware Server. Getting Started Guide. Revision Warning and Disclaimer

Lab 5 Explicit Proxy Performance, Load Balancing & Redundancy

Introducing the BIG-IP and SharePoint Portal Server 2003 configuration

How do I load balance FTP on NetScaler?

Reporting for Contact Center Setup and Operations Guide. BCM Contact Center

Web Security Log Server Error Reference

1 Recommended Readings. 2 Resources Required. 3 Compiling and Running on Linux

Contents. Introduction. Prerequisites. Requirements. Components Used

Exploiting the Web with Tivoli Storage Manager

User Manual. Onsight Management Suite Version 5.1. Another Innovation by Librestream

SAM Server Utility User s Guide

PC Requirements and Technical Help. Q1. How do I clear the browser s cache?

Lecture 8a: WWW Proxy Servers and Cookies

W H I T E P A P E R : T E C H N I C A L. Understanding and Configuring Symantec Endpoint Protection Group Update Providers

Setting Up SSL on IIS6 for MEGA Advisor

DSL- G604T Frequently asked Questions.

Virtual Managment Appliance Setup Guide

Web Conferencing Version 8.3 Troubleshooting Guide

vcenter Chargeback User s Guide vcenter Chargeback 1.0 EN

Using TestLogServer for Web Security Troubleshooting

You need to set up your browser in order to use the proxy server. This can be done as follows:

XCM Internet Explorer Settings

LabVIEW Internet Toolkit User Guide

Leica Geosystems Software Licensing Introduction & Installation

Security IIS Service Lesson 6

ARR Reverse proxy deployment for Lync 2013

AXIGEN Mail Server. Quick Installation and Configuration Guide. Product version: 6.1 Document version: 1.0

Setting up an Apache Web Server for Greenstone 2 Walkthrough

End of Sale/End of Life Report Tool Usage Notes for CiscoWorks NCM 1.6

Load Balancing BEA WebLogic Servers with F5 Networks BIG-IP v9

Modern snoop lab lite version

Central Administration User Guide

Collax Web Security. Howto. This howto describes the setup of a Web proxy server as Web content filter.

The current case DNSChanger what computer users can do now

Transcription:

Lab 5: HTTP Web Proxy Server In this lab, you will learn how web proxy servers work and one of their basic functionalities caching. Your task is to develop a small web proxy server which is able to cache web pages. It is a very simple proxy server which only understands simple GET-requests, but is able to handle all kinds of objects - not just HTML pages, but also images. Generally, when the client makes a request, the request is sent to the web server. The web server then processes the request and sends back a response message to the requesting client. In order to improve the performance we create a proxy server between the client and the web server. Now, both the request message sent by the client and the response message delivered by the web server pass through the proxy server. In other words, the client requests the objects via the proxy server. The proxy server will forward the client s request to the web server. The web server will then generate a response message and deliver it to the proxy server, which in turn sends it to the client. Client Response Proxy Server Response Web Server Code Below you will find the skeleton code for the client. You are to complete the skeleton code. The places where you need to fill in code are marked with #Fill in start and #Fill in end. Each place may require one or more lines of code. Running the Proxy Server Run the proxy server program using your command prompt and then request a web page from your browser. Direct the requests to the proxy server using your IP address and port number. For e.g. http://localhost:8888/www.google.com To use the proxy server with browser and proxy on separate computers, you will need the IP address on which your proxy server is running. In this case, while running the proxy, you will have to replace the localhost with the IP address of the computer where the proxy server is running. Also note the port number used. You will replace the port number used here 8888 with the port number you have used in your server code at which your proxy server is listening. Configuring your Browser You can also directly configure your web browser to use your proxy. This depends on your browser. In Internet Explorer, you can set the proxy in Tools > Internet Options > Connections tab > LAN Settings. In Netscape (and derived browsers such as Mozilla), you can set the proxy in Tools > Options > Advanced tab > Network tab > Connection Settings. In both cases you need to give the address of the proxy and the port number that you gave when you ran the proxy server. You should be

able to run the proxy and the browser on the same computer without any problem. With this approach, to get a web page using the proxy server, you simply provide the URL of the page you want. For e.g. http://www.google.com What to Hand in You will hand in the complete proxy server code and screenshots at the client side verifying that you indeed get the web page via the proxy server.

Skeleton Python Code for the Proxy Server from socket import * import sys if len(sys.argv) <= 1: print 'Usage : "python ProxyServer.py server_ip"\n[server_ip : It is the IP Address Of Proxy Server' sys.exit(2) # Create a server socket, bind it to a port and start listening tcpsersock = socket(af_inet, SOCK_STREAM) while 1: # Strat receiving data from the client print 'Ready to serve...' tcpclisock, addr = tcpsersock.accept() print 'Received a connection from:', addr message = print message # Extract the filename from the given message print message.split()[1] filename = message.split()[1].partition("/")[2] print filename fileexist = "false" filetouse = "/" + filename print filetouse try: # Check wether the file exist in the cache f = open(filetouse[1:], "r") outputdata = f.readlines() fileexist = "true" # ProxyServer finds a cache hit and generates a response message tcpclisock.send("http/1.0 200 OK\r\n") tcpclisock.send("content-type:text/html\r\n") print 'Read from cache' # Error handling for file not found in cache except IOError: if fileexist == "false": # Create a socket on the proxyserver c = hostn = filename.replace("www.","",1)

else: print hostn try: except: # Connect to the socket to port 80 # Create a temporary file on this socket and ask port 80 for the file requested by the client fileobj = c.makefile('r', 0) fileobj.write("get "+"http://" + filename + " HTTP/1.0\n\n") # Read the response into buffer # Create a new file in the cache for the requested file. # Also send the response in the buffer to client socket and the corresponding file in the cache tmpfile = open("./" + filename,"wb") print "Illegal request" # HTTP response message for file not found # Close the client and the server sockets tcpclisock.close() Optional Exercises 1. Currently the proxy server does no error handling. This can be a problem especially when the client requests an object which is not available, since the "404 Not found" response usually has no response body and the proxy assumes there is a body and tries to read it. 2. The simple proxy server supports only HTTP GET method. Add support for POST, by including the request body sent in the POST-request. 3. Caching: A typical proxy server will cache the web pages each time the client makes a particular request for the first time. The basic functionality of caching works as follows. When the proxy gets a request, it checks if the requested object is cached, and if yes, it returns the object from the cache, without contacting the server. If the object is not cached, the proxy retrieves the object from the server, returns it to the client and caches a copy for future requests. In practice, the proxy server must verify that the cached responses are still valid and that they are the correct responses to the client's requests. You can read more about caching and how it is handled in HTTP in RFC 2068. Add the simple caching functionality described above. You do not need to implement any replacement or validation policies. Your implementation, however, will need to be able to write

responses to the disk (i.e., the cache) and fetch them from the disk when you get a cache hit. For this you need to implement some internal data structure in the proxy to keep track of which objects are cached and where they are on the disk. You can keep this data structure in main memory; there is no need to make it persist across shutdowns.