⚠ To share assignment solutions and source code is not permitted under our academic honesty policy. Violation of this will result in your assignment submission attracting no marks, and you may face disciplinary actions in addition.
A web proxy server serves as an intermediary between a web server and a web client (e.g., a web browser). All web requests from the client and all responses from the server pass through the proxy server. This allows the proxy server to monitor the activities and when required filter requests and/or responses. For instance, the proxy server may keep an account of how much data is used by the client, block access to certain sites, transform or block some of the content received from sites, etc. Some proxy servers also cache responses so that multiple clients connecting through the same proxy server can benefit from data previously accessed by other connected clients.
High-level workflows of a web server, web client, and proxy server are illustrated below.
A web server
A web client
A proxy server is both a web server and a web client, and thus it
You are required to build a configurable HTTP proxy server. The proxy server should be built as a simple command-line application.
The proxy server should be capable of request filtering. This means the proxy server will not allow access to servers that are in black-listed domains. For example, if the the domain badsite.org is black-listed with the proxy server, requests to any host in this domain will not be allowed by the proxy.
The proxy server would also convert all the images that it passes through to grayscale images. The simplest (though not a fast) way to convert a picture to grayscale is to iterate through each pixel and set the RGB components of the pixel to the effective luminenance of the source pixel. In other words, R' = G' = B' = 0.30 R + 0.59 G + 0.11 B where R', G', and B' are the RGB components of the grayscale pixel and R, G, and B are the RGB components of the source pixel.
The proxy server should implement at least GET, POST, OPTIONS, and TRACE methods. The server should return the HTTP status code 501 (Method Not Implemented) for any method it does not implement.
A Via HTTP header should be added by the proxy server for all the requests and responses that pass through the server. The value of the Via header should be set to CS_Pr0xy.
An XML configuration file specifies four configurable attributes of the proxy server.
If an attribute is not defined in the configuration file, its default value should be used.
The configuration file should be named after your proxy server application and may have the file extension .config. If the configuration file does not exist, the default values should be used by the proxy server.
A sample configuration file is shown below.
<?xml version="1.0" encoding="utf-8"?> <!--Proxy Server Configuration--> <configuration> <appSettings> <add key="BlackList" value="badsite.org,verybadsite.com" /> <add key="UpstreamProxy" value="gate.ec.auckland.ac.nz:8008" /> </appSettings> </configuration>
These are some sample proxy configurations.
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="BlackList" value="" /> </appSettings> </configuration>
<?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="BlackList" value="" /> <add key="UpstreamProxy" value="gate.ec.auckland.ac.nz:8008" /> </appSettings> </configuration>
Please consult the Assignment Dropbox for the due date of the assignment.
You are to submit electronically:
This assignment will not be accepted after the due date of the assignment.
This optional assignment carries 2% towards the final mark for the paper.
Last updated Sat Mar 04 09:20:23 NZDT 2017 by mano.