Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP3310 Assignment 2: An annoying web-proxy
Background:
• This assignment is worth 15% of the final mark
• It is due by 23:59 Sunday 9 May AEST - note: CANBERRA TIME (gmt+10)
• Late submissions will not be accepted, except in special circumstances
o Extensions must be requested well before the due date, via the course convenor,
with appropriate evidence.
This is a coding assignment, to enhance and check your network programming skills. The main focus
is on native socket programming, and your ability to understand and implement the key elements of
an application protocol from its RFC specification.
Assignment 2 outline
A web-proxy is a simple web-client and web-server wrapped in a single application. It receives
requests from one or more clients (web-browsers) for particular content URLs, and forwards them
on to the intended server, then returns the result to your web-browser - in some form. How is this
useful?
• It can cache content, so the second and later clients to make the same request get a more
rapid response, and free up network capacity.
• It can filter content, to ensure that content coming back is ‘safe’, e.g. for children or your
home, or for staff/their computers inside an organisation.
• It can filter requests, to ensure that people don’t access things they shouldn’t, for whatever
policy reasons one might have.
• It can listen to requests/responses and learn things, i.e. snoop on the traffic. Getting people
to use your proxy though is a different challenge...
o And of course it can listen to and modify requests/responses, for fun or profit.
For this assignment, you need to write a web proxy in C or Java, without the use of any external
web/http-related libraries (html-parsing support is ok). ENGN students with limited C/Java
backgrounds should talk with their tutors as we have other options there, though the requirements
will be the same and more closely considered. As most networking server code is written in C, with
other languages a distant second, it is worth learning it.
Your code MUST open sockets in the standard socket() API way, as per the tutorial exercises. Your
code MUST make appropriate and correctly-formed HTTP/1.0 (RFC1945) or HTTP/1.1 enhanced
requests (to a web-server, as a client) and responses (to a web-browser, as a server) on its own, and
capture/interpret the results on its own in both directions. You will be handcrafting HTTP packets, so
you’ll need to understand the structures of requests/responses and HTTP headers.
Wireshark will be helpful for debugging purposes, compare it to a direct web-browser transaction.
The most common trap is not getting your line-ending ‘\n\n’ right on requests, and this is rather OS
and language-specific. Remember to be conservative in what you send and reasonably liberal in what
you accept.