Ask Computer Network & Security Expert

Computer Networks Assignment Laboratory: Web Proxy Server

I. Outline

Note that you are neither required to follow these steps nor required to use the skeleton code [link]. In the skeleton code, the missing parts that require your implementation is marked with a comment /********TO BE IMPLEMENTED********/. Please feel free to modify the helper classes if you prefer.

1. Run the client program ( client.h/cc) and understand the usage of the helper classes. Refer to .h files for function definitions and their purposes. Refer to .cc files for implementations. More information can be found in Section 4.

2. Complete the missing part of proxy.cc. Create a TCP socket to accept connection. For TCPSocket class, please use try/catch to capture exceptions. You can find samples in client program. Refer to Section 12 for logs.

3. Complete the five functions that has missing part in ProxyWorker.cc, in the following order, getRequest, checkRequest, forwardRequest, getResponse, and returnResponse. More details can be found in Section 8.

4. In getResponse, complete identify/default transfer encoding before working on chun- ked transfer encoding (Section 4). Refer to client program for more details.

5. Work on keyword filtering. Note that one requirement is filtering the hostname and the other is filtering the path. (Section 8).

6. Work on subliminal messages (Section 5).

7. Try your proxy with real browsers (not required).

II. Goals

Apply your knowledge of socket programming in order to implement a real-world application and gain some basic understanding of HTTP.

III. Overview

In this lab, you will implement a simple proxy server for HTTP that forwards requests from clients to end servers and returns responses from end servers to the clients. You will also implement a special function that inserts subliminal messages between HTTP web pages.

IV. Guidelines

Working alone or in pairs. You may work on this assignment individually or in pairs (not in groups of 3 or more, however). If you prefer to work in a pair, both students must submit a copy of the solution and identify their MSU NetID in a README file. If you prefer to work individually, please clearly state that you are working individually and include your MSU NetID in the README file.

Programming Language. You must implement this project using C++. The skeleton code is written in C++. Please clearly state the command to compile your project submission in your README file.

Testing your code. Each Linux distribution might be slightly different. It is the students' responsibility to make sure that the lab submissions compile on at least one of the following machines in 3353 EB: carl, ned, marge, mcclure, apu, krusty, rod or skinner. A statement must be provided in the README file's header. You will not be awarded any credit if your lab submission does not compile on any of those machines.

V. Specification

In this lab, you are required to implement a proxy that forwards GET requests from a client to the server and returns the responses from the server back to the client. The port for

listening to incoming request is assigned by the operating system. This lab addresses only non-persistent connections. The proxy is expected to be able to handle multiple requests by spawning a separate thread to handle each request. Both default (identity) encoding and chunked transfer encoding must be handled by this proxy. The requirement of the proxy is listed as follows.

Subliminal messages: The proxy needs to insert subliminal message webpages for HTTP requests where the target webpages has a filename extension of either .html or .htm. A supporting function HTTPRequest::isHtml is also provided for this purpose. A support- ing function ProxyWorker::subliminalResponse is provided to generate the subliminal response. Set the message duration to 0 will makes the response to flash and act like a subliminal message.

Modify Server field in the response header: To help with debugging, you are re- quired to add/modify a field in the response header, saying that this response is returned by your proxy. Specifically, you are required to add (or modify) the field Server with a string, such as your MSU NetID, showing the header has been modified. The method HTTPResponse::setHeaderField is able to do this.

Host not found: The proxy is expected to respond with error messages to bad requests. For a request that tries to download an object from a host that does not exist, the proxy returns a 404 Not Found response. As long as the end server exists, it is the responsibility of the server, not the proxy, to determine whether or not the requested web object exists. The proxy simply forwards the request and returns the response. A supporting function ProxyWorker::proxyResponse is provided for you to create response when error occurs.

Filtering: The proxy is expected to perform simple filtering.

1. The proxy rejects any request to a host containing the keyword "umich.edu" but allows requests where the file path contains the "umich.edu" keyword. The proxy returns a 403 Forbidden response for the former request. For example, the proxy shoud reject a request to http://umich.edu, but should forward to the server a request for
http://www.cse.msu.edu/~liuchinj/cse422ss17/lab2 files/umich.html

2. The proxy redirects any request to a path containing the keyword "harbaugh" to
http://www.cse.msu.edu/~liuchinj/cse422ss17/lab2 files/whoa.html

You can operate on the host and path information in the request using the supporting func- tions HTTPRequest::getHost, HTTPRequest::getPath, HTTPRequest::setHost and HTTPRequest::setPath before forwarding the request to the server. Alternatively, your proxy can also create a response that gives the client the Webpage you want using HTTPResponse class and replies the new response to the client without contacting the actual server.

Transfer Encoding: The proxy is required to handle both default transfer encoding and chunked transfer encoding. For default transfer encoding, the proxy is required to display (print to the console) the content length. For chunked transfer encoding, the proxy is required to display (print to the console) the length of each chunk.

Attachment:- Attachments.rar

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M92243595

Have any Question?


Related Questions in Computer Network & Security

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Security challenges in emerging networksassignment

Security Challenges in Emerging Networks Assignment Description The purpose of this assignment is to develop skills to independently think of innovation. In this assignment students will first learn how to develop knowle ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Advanced network design assessment - human factors in

Advanced Network Design Assessment - Human factors in network analysis and design Purpose of the assessment - This assignment is designed to assess students' knowledge and skills related to the following learning outcome ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

Assignment descriptionproject scope a typical network

Assignment Description Project Scope: A typical network layout diagram of a firm is given below for illustrative purposes only. The service requirements are enclosed. Figure. Network layout of a firm Service requirements ...

After reading this weeks materials please respond to two 2

After reading this week's materials, please respond to TWO (2) of the following questions. AND PROVIDE CITATION IN APA 1. Describe the differences between bus, ring, star and mesh topologies. 2. Explain the TCP/IP Model ...

The abstract should not be more than 250 words describe

The abstract should not be more than 250 words. Describe your project, focusing on research questions and research method for next stage of the project. 1. Introduction [The introduction should describe what the project ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As