CS 475 Assignment 3: Implementing an HTTP 1.0 Server and Client, Assignments of Computer Science

An assignment for a computer science course at george mason university, where students are required to develop an http 1.0 client and server. The client and server must interact using http/1.0, and the server must implement get, head, and a custom getlist method. The server must be multi-threaded and able to serve html, gif, jpeg, and postscript files. Students are encouraged to consult http 1.0 standards and solaris documentation for implementation details.

Typology: Assignments

Pre 2010

Uploaded on 02/12/2009

koofers-user-q7w
koofers-user-q7w 🇺🇸

9 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
GEORGEMASONUNIVERSITY
ComputerScienceDepartment
Concurrent & Distributed Software Systems -- CS 475
Spring2003
Assignment3 NetworkProgrammingusingSockets
DUEDATEApril 7
Write a HTTP 1.0 client and server
The client and server must interact using HTTP/1.0. and
The server must implement GET and HEAD requests from HTTP/1.0
The server must also implement a GETLIST method. This method allows the client to request a set of documents
from the server. The idea is that the client can use the GET method to retrieve an HTML file and then use the
GETLIST method to retrieve in one exchange all the images embedded in the web page corresponding to the
HTML file. You have to design the exact formatfor a GETLIST request and response. You should follow the
general format of other HTTP 1.0 requests and responses. The client should use the Content-length field to split
the response into its components. To simplify your implementation of the client, you can assume that the server
returns an optional header in response to a GET request that includesthe names of any images embedded in the
document being retrieved.
The server must be multi-threaded
The server must be able to retrieve at least HTML, GIF, JPEG, and Postscript files (as implied by the usual
extensions) and return them with the appropriate “Content-Type” specification. Your server must also return
appropriate error codes 200, 404, etc.
The server must generate a log entry for each access by a client that shows the identity of the client as well as
other information pertaining to the access.
The server must be configured to search for requested files in a default directory that you specify
The client must also generate a log recording its interactions with the server (The purpo seof the client and server
logs is to assist in debugging the program, and for showing me that your program works correctly).
A typical interaction between a client and a web server, as well as the format of log entries generated by the server is
shown on the next page.
You have to implement two versions of your program. In the first version, the HTTP protocol should be imple-
mented on top of TCP, whereas in the second version, HTTPis implemented on top of UDP. (For the UDP implemen-
tation, you do not have to provide reliable transport. You can also assume that the files that will be served by the web
server are small enough to fit in one datagram.)
NOTES:
1. Choosing a server port. You will need to run a server process that can coexist with other people’s processes
in the same computer. You will need to select an agreed port number for the server to accept messages from
clients. Two servers on the same computer cannot use the same local port number. You will therefore need to
choose a port number that is different from that of other people. Note that your HTTP server will not be able to
use port 80 (unless you’rethe administrator for the machine it is running on.)
2. There are links on the class web page to the HTTP 1.0 standard. You will need to consultthese documents for
the exact format of the GET and HEAD requests and responses.
3. Solaris documentation on network programming is available at http://docs.sun.com
1
pf3

Partial preview of the text

Download CS 475 Assignment 3: Implementing an HTTP 1.0 Server and Client and more Assignments Computer Science in PDF only on Docsity!

GEORGE MASON UNIVERSITY

Computer Science Department

Concurrent & Distributed Software Systems -- CS 475

Spring 200 3

Assignment 3 Network Programming using Sockets

DUE DATE – April 7

Write a HTTP 1.0 client and server

  • The client and server must interact using HTTP/1.0. and
  • The server must implement GET and HEAD requests from HTTP/1.
  • The server must also implement a GETLIST method. This method allows the client to request a set of documents from the server. The idea is that the client can use the GET method to retrieve an HTML file and then use the GETLIST method to retrieve in one exchange all the images embedded in the web page corresponding to the HTML file. You have to design the exact format for a GETLIST request and response. You should follow the general format of other HTTP 1.0 requests and responses. The client should use the Content-length field to split the response into its components. To simplify your implementation of the client, you can assume that the server returns an optional header in response to a GET request that includes the names of any images embedded in the document being retrieved.
  • The server must be multi-threaded
  • The server must be able to retrieve at least HTML, GIF, JPEG, and Postscript files (as implied by the usual extensions) and return them with the appropriate “Content-Type” specification. Your server must also return appropriate error codes – 200, 404, etc.
  • The server must generate a log entry for each access by a client that shows the identity of the client as well as other information pertaining to the access.
  • The server must be configured to search for requested files in a default directory that you specify
  • The client must also generate a log recording its interactions with the server (The purpose of the client and server logs is to assist in debugging the program, and for showing me that your program works correctly).

A typical interaction between a client and a web server, as well as the format of log entries generated by the server is shown on the next page. You have to implement two versions of your program. In the first version, the HTTP protocol should be imple- mented on top of TCP, whereas in the second version, HTTP is implemented on top of UDP. (For the UDP implemen- tation, you do not have to provide reliable transport. You can also assume that the files that will be served by the web server are small enough to fit in one datagram.)

NOTES:

  1. Choosing a server port. You will need to run a server process that can coexist with other people’s processes in the same computer. You will need to select an agreed port number for the server to accept messages from clients. Two servers on the same computer cannot use the same local port number. You will therefore need to choose a port number that is different from that of other people. Note that your HTTP server will not be able to use port 80 (unless you’re the administrator for the machine it is running on.)
  2. There are links on the class web page to the HTTP 1.0 standard. You will need to consult these documents for the exact format of the GET and HEAD requests and responses.
  3. Solaris documentation on network programming is available at http://docs.sun.com
  1. You can reuse any of Comer’s or Stevens’ code for this assignment. There is a link on the class home page to the URLs where this code can be obtained. You can also do this assignment in Java. Feel free to use code from Java network programming texts or tutorials for this assignment. It is ok to borrow “boilerplate” code or helper classes or procedures for network programming. It is not ok to borrow all or most of the code needed to complete this assignment. Any classes, procedures that you borrow from another source needs to be clearly marked as such. Please do not borrow code that may be available on the web for implementing a HTTP server. I consider that a violation of the Univ’s honor code, and will treat it as such.
  2. You have to submit: (a) the client program (b) the server program (c) output showing your program works correctly (you can run both the client and the server on the same computer for generating this output). Your code should be well documented and structured, i.e., it should have meaningful comments, meaningful variable names, etc. Your server should work with a browser such as Netscape or Internet Explorer.