For this assignment, you must implement an Internet resource retriever to act as a client and to make requests to a server, including the basic Web server you have implemented. The basic Web server’s task is to deliver resources to the client. The client requests a particular resource by writing an HTTP GET (or similar) request. On receiving a legitimate request in the form of a URL path, the server should return the contents of the corresponding file so that the client can read the response from the server via the proxy server. When networking facilities are available, the basic Web server (or any other server) can be executed on one machine and the client can be executed on another to make requests to the server. When networking facilities are not available, both the basic Web server and the client may be executed on the same machine. The client may refer to the server host by the standard name localhost.
Tutor-marked Exercise (TME) 1 requires that you develop three programs: one for a client, one for a basic Web server, and one for a proxy server.
A proxy server is a special-purpose HTTP server; it is the core application for this project. The proxy server has two socket connections. It “listens” for communication from clients through one and launches requests to specific Web servers through the other. In this exercise you should use a thread in the proxy server so that it is able to send and receive messages simultaneously to and from the server/client.
A basic Web server can deal with requests for resources from a client. It is necessary to have a Web server return messages to a client such as 404 - not found; 403 - bad request; etc., as appropriate. If the resource requested is available, which means that the resource can be found on the disk of the Web server, the Web server needs to read the resource and write the data to the socket. For example, a Web server may find an HTML file or a JPEG (image) file on its disk and transfer the data to the socket.
The client basically needs access to the function that allows the user to input the resource URL that identifies the resource s/he wants to access. However, the client has to access the resource by sending a request to the proxy server, and then the client must receive the resource from the proxy server. No matter what kind of data the client receives, the client only needs to print it on the screen. Note that where the response from a server is an HTML file, a typical Web browser will render it according to HTML semantics. This functionality is not considered in this exercise.
Note: Your tutor may use resource URLs other than those for the basic Web server (e.g., Java tutorial Web pages and public FTP files).
To test your basic Web server’s function you can simply use an HTML file named testfile.html and a JPG file name testfile.jpg with Microsoft Internet Explorer or Mozilla Firefox. After you are completely certain that your basic Web server works properly, you can use http://127.0.0.1/testfile.html or http://localhost/testfile.jpg with your client to test whether your proxy works. Finally, try to use http://www.google.com or ftp://ftp.us.dell.com/readme.txt within your client to test whether your proxy works properly.
Your assignment must be zipped into one file and uploaded using the Assignment Drop Box feature of Moodle. The file must include
- all source files.
- a complete test plan.
Before you submit your TME, please review Tutor-marked Exercise Requirements for full details of TME requirements and to review the marking scheme. Please contact your tutor if you have any questions.
Note: Your tutor will not accept TMEs by email.
Submitting your assignments
- Use the Add submission OR Edit submission button below to upload your completed assignment file(s).
- Remember to click the Save changes button after uploading files
- The maximum upload file size is 501MB
- You can upload a maximum of 1 files
- Remember to click the Submit assignment button after you upload your assignment file(s), enter your online text or record your audio file.